diff options
author | Dave Reisner <dreisner@archlinux.org> | 2014-03-08 11:25:35 -0500 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2014-03-08 11:25:35 -0500 |
commit | e03e8083dcf5444e6e6785fd227c4f0e634cb5ae (patch) | |
tree | d40f6fce0e73d2dee8ae9cc7d57b0b45664eb05a | |
parent | 257d1e78454c12053ae7a5b24d9a81ae92940b62 (diff) | |
download | expac-e03e8083dcf5444e6e6785fd227c4f0e634cb5ae.tar.xz |
add print_allocated_list for lists which need to be freed
-rw-r--r-- | expac.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -402,6 +402,12 @@ static int print_list(alpm_list_t *list, extractfn fn, bool shortdeps) { return out; } +static int print_allocated_list(alpm_list_t *list, extractfn fn, bool shortdeps) { + int out = print_list(list, fn, shortdeps); + alpm_list_free(list); + return out; +} + static int print_time(time_t timestamp) { char buffer[64]; int out = 0; @@ -613,17 +619,11 @@ static int print_pkg(alpm_pkg_t *pkg, const char *format) { out += print_list(alpm_pkg_get_backup(pkg), alpm_backup_get_name, shortdeps); break; case 'V': /* package validation */ - out += print_list(get_validation_method(pkg), NULL, false); + out += print_allocated_list(get_validation_method(pkg), NULL, false); break; case 'M': /* modified */ - { - alpm_list_t *modified_files = get_modified_files(pkg); - if(modified_files != NULL) { - out += print_list(modified_files, NULL, shortdeps); - alpm_list_free(modified_files); - } + out += print_allocated_list(get_modified_files(pkg), NULL, shortdeps); break; - } case '%': fputc('%', stdout); out++; |