mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 03:25:31 +03:00
sysv-generator: use strextend_with_separator()
This commit is contained in:
parent
742a011a3a
commit
580bf61304
@ -533,7 +533,7 @@ static int load_sysv(SysvStub *s) {
|
|||||||
* continuation */
|
* continuation */
|
||||||
|
|
||||||
size_t k;
|
size_t k;
|
||||||
char *j;
|
const char *j;
|
||||||
|
|
||||||
k = strlen(t);
|
k = strlen(t);
|
||||||
if (k > 0 && t[k-1] == '\\')
|
if (k > 0 && t[k-1] == '\\')
|
||||||
@ -542,19 +542,8 @@ static int load_sysv(SysvStub *s) {
|
|||||||
state = NORMAL;
|
state = NORMAL;
|
||||||
|
|
||||||
j = strstrip(t);
|
j = strstrip(t);
|
||||||
if (!isempty(j)) {
|
if (!isempty(j) && !strextend_with_separator(&chkconfig_description, " ", j))
|
||||||
char *d = NULL;
|
return log_oom();
|
||||||
|
|
||||||
if (chkconfig_description)
|
|
||||||
d = strjoin(chkconfig_description, " ", j);
|
|
||||||
else
|
|
||||||
d = strdup(j);
|
|
||||||
if (!d)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
free(chkconfig_description);
|
|
||||||
chkconfig_description = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (IN_SET(state, LSB, LSB_DESCRIPTION)) {
|
} else if (IN_SET(state, LSB, LSB_DESCRIPTION)) {
|
||||||
|
|
||||||
@ -604,20 +593,8 @@ static int load_sysv(SysvStub *s) {
|
|||||||
const char *j;
|
const char *j;
|
||||||
|
|
||||||
j = strstrip(t);
|
j = strstrip(t);
|
||||||
if (!isempty(j)) {
|
if (!isempty(j) && !strextend_with_separator(&long_description, " ", j))
|
||||||
char *d = NULL;
|
return log_oom();
|
||||||
|
|
||||||
if (long_description)
|
|
||||||
d = strjoin(long_description, " ", t);
|
|
||||||
else
|
|
||||||
d = strdup(j);
|
|
||||||
if (!d)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
free(long_description);
|
|
||||||
long_description = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
state = LSB;
|
state = LSB;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user