archival/*: shrink by reusing sufficiently similar functions
function old new delta append_ext - 16 +16 unxz_main 77 83 +6 unlzma_main 77 83 +6 uncompress_main 42 48 +6 gzip_main 184 190 +6 bzip2_main 114 120 +6 bunzip2_main 61 67 +6 bbunpack 469 475 +6 send_tree 355 360 +5 lzop_main 89 92 +3 gunzip_main 61 64 +3 make_new_name_lzop 84 82 -2 make_new_name_gunzip 114 112 -2 make_new_name_unxz 14 - -14 make_new_name_unlzma 14 - -14 make_new_name_uncompress 14 - -14 make_new_name_bunzip2 14 - -14 make_new_name_gzip 17 - -17 make_new_name_bzip2 17 - -17 ------------------------------------------------------------------------------ (add/remove: 1/6 grow/shrink: 10/2 up/down: 69/-94) Total: -25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@ -102,7 +102,7 @@ IF_DESKTOP(long long) int bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, vo
|
||||
}
|
||||
|
||||
static
|
||||
IF_DESKTOP(long long) int compressStream(unpack_info_t *info UNUSED_PARAM)
|
||||
IF_DESKTOP(long long) int FAST_FUNC compressStream(unpack_info_t *info UNUSED_PARAM)
|
||||
{
|
||||
IF_DESKTOP(long long) int total;
|
||||
ssize_t count;
|
||||
@ -135,12 +135,6 @@ IF_DESKTOP(long long) int compressStream(unpack_info_t *info UNUSED_PARAM)
|
||||
return total;
|
||||
}
|
||||
|
||||
static
|
||||
char* make_new_name_bzip2(char *filename)
|
||||
{
|
||||
return xasprintf("%s.bz2", filename);
|
||||
}
|
||||
|
||||
int bzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int bzip2_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
@ -181,5 +175,5 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
argv += optind;
|
||||
option_mask32 &= 0x7; /* ignore all except -cfv */
|
||||
return bbunpack(argv, make_new_name_bzip2, compressStream);
|
||||
return bbunpack(argv, compressStream, append_ext, "bz2");
|
||||
}
|
||||
|
Reference in New Issue
Block a user