From: Denis Vlasenko Date: Wed, 14 Mar 2007 00:06:51 +0000 (-0000) Subject: gzip: reduce global data footprint, part 3 X-Git-Tag: 1_5_1~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07766bb0e7adcefa5dd5a373986176a5cd42ed23;p=platform%2Fupstream%2Fbusybox.git gzip: reduce global data footprint, part 3 --- diff --git a/archival/gzip.c b/archival/gzip.c index 76ee1cf..c8444ac 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -355,8 +355,8 @@ struct global1 { uint32_t crc; /* shift register contents */ }; -extern struct global1 *global_ptr; -#define G1 (*(global_ptr - 1)) +extern struct global1 *ptr_to_globals; +#define G1 (*(ptr_to_globals - 1)) /* =========================================================================== @@ -972,7 +972,7 @@ struct global2 { }; -#define G2ptr ((struct global2*)(global_ptr)) +#define G2ptr ((struct global2*)(ptr_to_globals)) #define G2 (*G2ptr) @@ -2131,8 +2131,8 @@ int gzip_main(int argc, char **argv) } #endif - global_ptr = xzalloc(sizeof(struct global1) + sizeof(struct global2)); - global_ptr++; + ptr_to_globals = xzalloc(sizeof(struct global1) + sizeof(struct global2)); + ptr_to_globals++; G2.l_desc.dyn_tree = G2.dyn_ltree; G2.l_desc.static_tree = G2.static_ltree; G2.l_desc.extra_bits = extra_lbits; diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index fb87fe8..331fe34 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c @@ -455,6 +455,8 @@ static int huft_build(unsigned *b, const unsigned n, * bl, bd: number of bits decoded by tl[] and td[] */ /* called once from inflate_block */ + +/* map formerly local static variables to globals */ #define ml inflate_codes_ml #define md inflate_codes_md #define bb inflate_codes_bb diff --git a/libbb/messages.c b/libbb/messages.c index 7f23d4b..39bb4c9 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -56,4 +56,4 @@ WTMP_FILE; char bb_common_bufsiz1[BUFSIZ+1]; -void *global_ptr; +void *ptr_to_globals;