diff options
author | Denys Vlasenko | 2010-01-06 10:53:17 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-01-06 10:53:17 +0100 |
commit | aa4977d8e549d9fff2b2946f03d304e435eb20f1 (patch) | |
tree | bc7c7fe4ab64263a9f8356762cb8f7e77165de73 /archival/dpkg.c | |
parent | 86350f8d5f5d5a1006cffe0bedccd625f012702f (diff) | |
download | busybox-aa4977d8e549d9fff2b2946f03d304e435eb20f1.zip busybox-aa4977d8e549d9fff2b2946f03d304e435eb20f1.tar.gz |
libunarchive: clean up dirty hacks. code shrank as a result
function old new delta
cpio_main 526 539 +13
init_handle 57 58 +1
init_archive_deb_ar 34 35 +1
get_header_ar 408 409 +1
dpkg_main 3900 3901 +1
unpack_package 516 515 -1
rpm_main 1673 1672 -1
tar_main 774 767 -7
get_header_cpio 990 972 -18
data_extract_all 750 727 -23
get_header_tar 1631 1576 -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/6 up/down: 17/-105) Total: -88 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/dpkg.c')
-rw-r--r-- | archival/dpkg.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 2e24541..616bce9 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1446,7 +1446,7 @@ static void init_archive_deb_control(archive_handle_t *ar_handle) #endif /* Assign the tar handle as a subarchive of the ar handle */ - ar_handle->sub_archive = tar_handle; + ar_handle->dpkg__sub_archive = tar_handle; } static void init_archive_deb_data(archive_handle_t *ar_handle) @@ -1466,27 +1466,27 @@ static void init_archive_deb_data(archive_handle_t *ar_handle) #endif /* Assign the tar handle as a subarchive of the ar handle */ - ar_handle->sub_archive = tar_handle; + ar_handle->dpkg__sub_archive = tar_handle; } static void FAST_FUNC data_extract_to_buffer(archive_handle_t *archive_handle) { unsigned size = archive_handle->file_header->size; - archive_handle->ah_buffer = xzalloc(size + 1); - xread(archive_handle->src_fd, archive_handle->ah_buffer, size); + archive_handle->dpkg__buffer = xzalloc(size + 1); + xread(archive_handle->src_fd, archive_handle->dpkg__buffer, size); } static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept) { - ar_handle->sub_archive->action_data = data_extract_to_buffer; - ar_handle->sub_archive->accept = myaccept; - ar_handle->sub_archive->filter = filter_accept_list; + ar_handle->dpkg__sub_archive->action_data = data_extract_to_buffer; + ar_handle->dpkg__sub_archive->accept = myaccept; + ar_handle->dpkg__sub_archive->filter = filter_accept_list; unpack_ar_archive(ar_handle); close(ar_handle->src_fd); - return ar_handle->sub_archive->ah_buffer; + return ar_handle->dpkg__sub_archive->dpkg__buffer; } static void FAST_FUNC data_extract_all_prefix(archive_handle_t *archive_handle) @@ -1495,7 +1495,7 @@ static void FAST_FUNC data_extract_all_prefix(archive_handle_t *archive_handle) name_ptr += strspn(name_ptr, "./"); if (name_ptr[0] != '\0') { - archive_handle->file_header->name = xasprintf("%s%s", archive_handle->ah_buffer, name_ptr); + archive_handle->file_header->name = xasprintf("%s%s", archive_handle->dpkg__buffer, name_ptr); data_extract_all(archive_handle); } } @@ -1535,11 +1535,11 @@ static void unpack_package(deb_file_t *deb_file) llist_add_to(&accept_list, c); i++; } - archive_handle->sub_archive->accept = accept_list; - archive_handle->sub_archive->filter = filter_accept_list; - archive_handle->sub_archive->action_data = data_extract_all_prefix; - archive_handle->sub_archive->ah_buffer = info_prefix; - archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD; + archive_handle->dpkg__sub_archive->accept = accept_list; + archive_handle->dpkg__sub_archive->filter = filter_accept_list; + archive_handle->dpkg__sub_archive->action_data = data_extract_all_prefix; + archive_handle->dpkg__sub_archive->dpkg__buffer = info_prefix; + archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD; unpack_ar_archive(archive_handle); /* Run the preinst prior to extracting */ @@ -1548,19 +1548,19 @@ static void unpack_package(deb_file_t *deb_file) /* Extract data.tar.gz to the root directory */ archive_handle = init_archive_deb_ar(deb_file->filename); init_archive_deb_data(archive_handle); - archive_handle->sub_archive->action_data = data_extract_all_prefix; - archive_handle->sub_archive->ah_buffer = (char*)"/"; /* huh? */ - archive_handle->sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD; + archive_handle->dpkg__sub_archive->action_data = data_extract_all_prefix; + archive_handle->dpkg__sub_archive->dpkg__buffer = (char*)"/"; /* huh? */ + archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD; unpack_ar_archive(archive_handle); /* Create the list file */ list_filename = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, "list"); out_stream = xfopen_for_write(list_filename); - while (archive_handle->sub_archive->passed) { + while (archive_handle->dpkg__sub_archive->passed) { /* the leading . has been stripped by data_extract_all_prefix already */ - fputs(archive_handle->sub_archive->passed->data, out_stream); + fputs(archive_handle->dpkg__sub_archive->passed->data, out_stream); fputc('\n', out_stream); - archive_handle->sub_archive->passed = archive_handle->sub_archive->passed->link; + archive_handle->dpkg__sub_archive->passed = archive_handle->dpkg__sub_archive->passed->link; } fclose(out_stream); |