squash
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
e58d799c47
commit
5473c9fd3f
1 changed files with 10 additions and 3 deletions
|
@ -410,7 +410,6 @@ typedef char *(*formatfn)(void*);
|
||||||
static char *concat_list(alpm_list_t *lst, formatfn fn)
|
static char *concat_list(alpm_list_t *lst, formatfn fn)
|
||||||
{
|
{
|
||||||
char *output = NULL, *tmp = NULL;
|
char *output = NULL, *tmp = NULL;
|
||||||
asprintf(&output, "%s", "");
|
|
||||||
|
|
||||||
for(alpm_list_t *i = lst; i; i = alpm_list_next(i)) {
|
for(alpm_list_t *i = lst; i; i = alpm_list_next(i)) {
|
||||||
char *str = fn ? fn(i->data) : i->data;
|
char *str = fn ? fn(i->data) : i->data;
|
||||||
|
@ -419,15 +418,23 @@ static char *concat_list(alpm_list_t *lst, formatfn fn)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tmp) {
|
||||||
|
asprintf(&output, "%s %s", tmp, str);
|
||||||
|
free(tmp);
|
||||||
|
} else {
|
||||||
|
asprintf(&output, "%s", str);
|
||||||
|
}
|
||||||
tmp = output;
|
tmp = output;
|
||||||
asprintf(&output, "%s %s", tmp, str);
|
|
||||||
free(tmp);
|
|
||||||
|
|
||||||
if(fn) {
|
if(fn) {
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!output) {
|
||||||
|
asprintf(&output, "%s", "");
|
||||||
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue