From 8bb50782a5f0dd955a6fe18d381eb9322d1447e7 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 26 May 2006 23:44:51 +0000 Subject: Change llist_add_* to take the address of the list rather than returning the new head, and change all the callers. --- archival/ar.c | 2 +- archival/cpio.c | 2 +- archival/dpkg.c | 12 ++++++------ archival/dpkg_deb.c | 10 +++++----- archival/libunarchive/get_header_tar.c | 2 +- archival/libunarchive/init_handle.c | 3 +-- archival/tar.c | 4 ++-- archival/unzip.c | 4 ++-- 8 files changed, 19 insertions(+), 20 deletions(-) (limited to 'archival') diff --git a/archival/ar.c b/archival/ar.c index 7782af8..f9a6bb7 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -97,7 +97,7 @@ int ar_main(int argc, char **argv) while (optind < argc) { archive_handle->filter = filter_accept_list; - archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind++]); + llist_add_to(&(archive_handle->accept), argv[optind++]); } archive_xread_all(archive_handle, magic, 7); diff --git a/archival/cpio.c b/archival/cpio.c index 26f845b..478379c 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -88,7 +88,7 @@ int cpio_main(int argc, char **argv) while (optind < argc) { archive_handle->filter = filter_accept_list; - archive_handle->accept = llist_add_to(archive_handle->accept, argv[optind]); + llist_add_to(&(archive_handle->accept), argv[optind]); optind++; } diff --git a/archival/dpkg.c b/archival/dpkg.c index 3621db4..2895f4f 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1484,10 +1484,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle) /* We don't care about data.tar.* or debian-binary, just control.tar.* */ #ifdef CONFIG_FEATURE_DEB_TAR_GZ - ar_handle->accept = llist_add_to(NULL, "control.tar.gz"); + llist_add_to(&(ar_handle->accept), "control.tar.gz"); #endif #ifdef CONFIG_FEATURE_DEB_TAR_BZ2 - ar_handle->accept = llist_add_to(ar_handle->accept, "control.tar.bz2"); + llist_add_to(&(ar_handle->accept), "control.tar.bz2"); #endif /* Assign the tar handle as a subarchive of the ar handle */ @@ -1506,10 +1506,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle) /* We don't care about control.tar.* or debian-binary, just data.tar.* */ #ifdef CONFIG_FEATURE_DEB_TAR_GZ - ar_handle->accept = llist_add_to(NULL, "data.tar.gz"); + llist_add_to(&(ar_handle->accept), "data.tar.gz"); #endif #ifdef CONFIG_FEATURE_DEB_TAR_BZ2 - ar_handle->accept = llist_add_to(ar_handle->accept, "data.tar.bz2"); + llist_add_to(&(ar_handle->accept), "data.tar.bz2"); #endif /* Assign the tar handle as a subarchive of the ar handle */ @@ -1575,7 +1575,7 @@ static void unpack_package(deb_file_t *deb_file) while(all_control_files[i]) { char *c = (char *) xmalloc(3 + strlen(all_control_files[i])); sprintf(c, "./%s", all_control_files[i]); - accept_list= llist_add_to(accept_list, c); + llist_add_to(&accept_list, c); i++; } archive_handle->sub_archive->accept = accept_list; @@ -1705,7 +1705,7 @@ int dpkg_main(int argc, char **argv) llist_t *control_list = NULL; /* Extract the control file */ - control_list = llist_add_to(NULL, "./control"); + llist_add_to(&control_list, "./control"); archive_handle = init_archive_deb_ar(argv[optind]); init_archive_deb_control(archive_handle); deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index fc8b922..b99f227 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -36,13 +36,13 @@ int dpkg_deb_main(int argc, char **argv) ar_archive->filter = filter_accept_list_reassign; #ifdef CONFIG_FEATURE_DEB_TAR_GZ - ar_archive->accept = llist_add_to(NULL, "data.tar.gz"); - control_tar_llist = llist_add_to(NULL, "control.tar.gz"); + llist_add_to(&(ar_archive->accept), "data.tar.gz"); + llist_add_to(&control_tar_llist, "control.tar.gz"); #endif #ifdef CONFIG_FEATURE_DEB_TAR_BZ2 - ar_archive->accept = llist_add_to(ar_archive->accept, "data.tar.bz2"); - control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2"); + llist_add_to(&(ar_archive->accept), "data.tar.bz2"); + llist_add_to(&control_tar_llist, "control.tar.bz2"); #endif bb_opt_complementally = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; @@ -65,7 +65,7 @@ int dpkg_deb_main(int argc, char **argv) * it should accept a second argument which specifies a * specific field to print */ ar_archive->accept = control_tar_llist; - tar_archive->accept = llist_add_to(NULL, "./control"); + llist_add_to(&(tar_archive->accept), "./control"); tar_archive->filter = filter_accept_list; tar_archive->action_data = data_extract_to_stdout; } diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index cd38f45..c9308f9 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -206,7 +206,7 @@ char get_header_tar(archive_handle_t *archive_handle) archive_handle->action_header(archive_handle->file_header); archive_handle->flags |= ARCHIVE_EXTRACT_QUIET; archive_handle->action_data(archive_handle); - archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name); + llist_add_to(&(archive_handle->passed), file_header->name); } else { data_skip(archive_handle); } diff --git a/archival/libunarchive/init_handle.c b/archival/libunarchive/init_handle.c index 3cee84f..1813131 100644 --- a/archival/libunarchive/init_handle.c +++ b/archival/libunarchive/init_handle.c @@ -24,8 +24,7 @@ archive_handle_t *init_handle(void) archive_handle_t *archive_handle; /* Initialise default values */ - archive_handle = xmalloc(sizeof(archive_handle_t)); - memset(archive_handle, 0, sizeof(archive_handle_t)); + archive_handle = xzalloc(sizeof(archive_handle_t)); archive_handle->file_header = xmalloc(sizeof(file_header_t)); archive_handle->action_header = header_skip; archive_handle->action_data = data_skip; diff --git a/archival/tar.c b/archival/tar.c index e4008b0..f3594f6 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -551,7 +551,7 @@ static llist_t *append_file_list_to_list(llist_t *list) cur = cur->link; free(tmp); while ((line = bb_get_chomped_line_from_file(src_stream)) != NULL) - newlist = llist_add_to(newlist, line); + llist_add_to(&newlist, line); fclose(src_stream); } return newlist; @@ -800,7 +800,7 @@ int tar_main(int argc, char **argv) if (filename_ptr > argv[optind]) *filename_ptr = '\0'; - tar_handle->accept = llist_add_to(tar_handle->accept, argv[optind]); + llist_add_to(&(tar_handle->accept), argv[optind]); optind++; } diff --git a/archival/unzip.c b/archival/unzip.c index 2cb256c..0b1e6f9 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -180,7 +180,7 @@ int unzip_main(int argc, char **argv) case 1: /* Include files */ if (opt == 1) { - zaccept = llist_add_to(zaccept, optarg); + llist_add_to(&zaccept, optarg); } else if (opt == 'd') { base_dir = optarg; @@ -196,7 +196,7 @@ int unzip_main(int argc, char **argv) case 2 : /* Exclude files */ if (opt == 1) { - zreject = llist_add_to(zreject, optarg); + llist_add_to(&zreject, optarg); } else if (opt == 'd') { /* Extract to base directory */ base_dir = optarg; -- cgit v1.1