diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-12-05 04:04:54 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-12-05 04:04:54 +0400 |
commit | c71547ccfce9aff4e616c9c57a6602ca66c705e0 (patch) | |
tree | 2a7d985d08eb08fab73a28e1d2c9e726eb19fc9a /archival/libarchive | |
parent | 4ba6c5d3ba3d2c7922aff6b5c2e73b8325f1cf17 (diff) |
decompress_uncompress: move 'code' variable into loop - sole user
Apparently, gcc does this optimization itself, since generated code is the same.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libarchive')
-rw-r--r-- | archival/libarchive/decompress_uncompress.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c index e9bbfb9bd..4ccc8a697 100644 --- a/archival/libarchive/decompress_uncompress.c +++ b/archival/libarchive/decompress_uncompress.c @@ -78,7 +78,6 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) IF_DESKTOP(long long total_written = 0;) IF_DESKTOP(long long) int retval = -1; unsigned char *stackp; - long code; int finchar; long oldcode; long incode; @@ -143,8 +142,10 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) /* As above, initialize the first 256 entries in the table. */ /*clear_tab_prefixof(); - done by xzalloc */ - for (code = 255; code >= 0; --code) { - tab_suffixof(code) = (unsigned char) code; + { + int i; + for (i = 255; i >= 0; --i) + tab_suffixof(i) = (unsigned char) i; } do { @@ -175,6 +176,8 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) (insize << 3) - (n_bits - 1)); while (inbits > posbits) { + long code; + if (free_ent > maxcode) { posbits = ((posbits - 1) + @@ -191,13 +194,12 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) } { unsigned char *p = &inbuf[posbits >> 3]; - - code = ((((long) (p[0])) | ((long) (p[1]) << 8) | - ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask; + code = ((p[0] + | ((long) (p[1]) << 8) + | ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask; } posbits += n_bits; - if (oldcode == -1) { if (code >= 256) bb_error_msg_and_die("corrupted data"); /* %ld", code); */ @@ -244,7 +246,7 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) } /* Generate output characters in reverse order */ - while ((long) code >= (long) 256) { + while (code >= 256) { if (stackp <= &htabof(0)) bb_error_msg_and_die("corrupted data"); *--stackp = tab_suffixof(code); @@ -285,11 +287,10 @@ unpack_Z_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) } /* Generate the new entry. */ - code = free_ent; - if (code < maxmaxcode) { - tab_prefixof(code) = (unsigned short) oldcode; - tab_suffixof(code) = (unsigned char) finchar; - free_ent = code + 1; + if (free_ent < maxmaxcode) { + tab_prefixof(free_ent) = (unsigned short) oldcode; + tab_suffixof(free_ent) = (unsigned char) finchar; + free_ent++; } /* Remember previous code. */ |