diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-11 03:06:00 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-11 03:06:00 +0400 |
commit | 0381d422d9b40c0cf887d299224c7759875aefd8 (patch) | |
tree | 764583282951c07bb6b611bef2858c5375647094 /archival/libunarchive/filter_accept_list_reassign.c | |
parent | b6052724ffc9d45894147b70e7aff226938bd2d3 (diff) |
dpkg_deb: slight code shrink
ar: reuse existing ar unpacking code
get_header_tar: handle autodetection for tiny .tar.gz files too
unarchive.h: do not include CONFIGed out things
function old new delta
get_header_tar 1521 1534 +13
dpkg_deb_main 400 380 -20
ar_main 260 196 -64
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 13/-84) Total: -71 bytes
Diffstat (limited to 'archival/libunarchive/filter_accept_list_reassign.c')
-rw-r--r-- | archival/libunarchive/filter_accept_list_reassign.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/archival/libunarchive/filter_accept_list_reassign.c b/archival/libunarchive/filter_accept_list_reassign.c index 4f2d4cde5..4dbc2d13e 100644 --- a/archival/libunarchive/filter_accept_list_reassign.c +++ b/archival/libunarchive/filter_accept_list_reassign.c @@ -8,6 +8,8 @@ #include "libbb.h" #include "unarchive.h" +/* Built and used only if ENABLE_DPKG || ENABLE_DPKG_DEB */ + /* * Reassign the subarchive metadata parser based on the filename extension * e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz @@ -19,23 +21,25 @@ char FAST_FUNC filter_accept_list_reassign(archive_handle_t *archive_handle) if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) { const char *name_ptr; - /* Extract the last 2 extensions */ + /* Find extension */ name_ptr = strrchr(archive_handle->file_header->name, '.'); /* Modify the subarchive handler based on the extension */ -#if ENABLE_FEATURE_DEB_TAR_GZ - if (strcmp(name_ptr, ".gz") == 0) { + if (ENABLE_FEATURE_DEB_TAR_GZ + && strcmp(name_ptr, ".gz") == 0 + ) { archive_handle->action_data_subarchive = get_header_tar_gz; return EXIT_SUCCESS; } -#endif -#if ENABLE_FEATURE_DEB_TAR_BZ2 - if (strcmp(name_ptr, ".bz2") == 0) { + if (ENABLE_FEATURE_DEB_TAR_BZ2 + && strcmp(name_ptr, ".bz2") == 0 + ) { archive_handle->action_data_subarchive = get_header_tar_bz2; return EXIT_SUCCESS; } -#endif - if (ENABLE_FEATURE_DEB_TAR_LZMA && !strcmp(name_ptr, ".lzma")) { + if (ENABLE_FEATURE_DEB_TAR_LZMA + && strcmp(name_ptr, ".lzma") == 0 + ) { archive_handle->action_data_subarchive = get_header_tar_lzma; return EXIT_SUCCESS; } |