diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-14 00:06:51 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-14 00:06:51 +0000 |
commit | 07766bb0e7adcefa5dd5a373986176a5cd42ed23 (patch) | |
tree | d43553bc2fa6980fb99a098c9c363e6837844633 | |
parent | da799e82274ffa48c5a27c5d034f4f31ba06e29f (diff) | |
download | busybox-w32-07766bb0e7adcefa5dd5a373986176a5cd42ed23.tar.gz busybox-w32-07766bb0e7adcefa5dd5a373986176a5cd42ed23.tar.bz2 busybox-w32-07766bb0e7adcefa5dd5a373986176a5cd42ed23.zip |
gzip: reduce global data footprint, part 3
-rw-r--r-- | archival/gzip.c | 10 | ||||
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 2 | ||||
-rw-r--r-- | libbb/messages.c | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index 76ee1cf58..c8444ac25 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -355,8 +355,8 @@ struct global1 { | |||
355 | uint32_t crc; /* shift register contents */ | 355 | uint32_t crc; /* shift register contents */ |
356 | }; | 356 | }; |
357 | 357 | ||
358 | extern struct global1 *global_ptr; | 358 | extern struct global1 *ptr_to_globals; |
359 | #define G1 (*(global_ptr - 1)) | 359 | #define G1 (*(ptr_to_globals - 1)) |
360 | 360 | ||
361 | 361 | ||
362 | /* =========================================================================== | 362 | /* =========================================================================== |
@@ -972,7 +972,7 @@ struct global2 { | |||
972 | 972 | ||
973 | }; | 973 | }; |
974 | 974 | ||
975 | #define G2ptr ((struct global2*)(global_ptr)) | 975 | #define G2ptr ((struct global2*)(ptr_to_globals)) |
976 | #define G2 (*G2ptr) | 976 | #define G2 (*G2ptr) |
977 | 977 | ||
978 | 978 | ||
@@ -2131,8 +2131,8 @@ int gzip_main(int argc, char **argv) | |||
2131 | } | 2131 | } |
2132 | #endif | 2132 | #endif |
2133 | 2133 | ||
2134 | global_ptr = xzalloc(sizeof(struct global1) + sizeof(struct global2)); | 2134 | ptr_to_globals = xzalloc(sizeof(struct global1) + sizeof(struct global2)); |
2135 | global_ptr++; | 2135 | ptr_to_globals++; |
2136 | G2.l_desc.dyn_tree = G2.dyn_ltree; | 2136 | G2.l_desc.dyn_tree = G2.dyn_ltree; |
2137 | G2.l_desc.static_tree = G2.static_ltree; | 2137 | G2.l_desc.static_tree = G2.static_ltree; |
2138 | G2.l_desc.extra_bits = extra_lbits; | 2138 | G2.l_desc.extra_bits = extra_lbits; |
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index fb87fe88d..331fe34d8 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, | |||
455 | * bl, bd: number of bits decoded by tl[] and td[] | 455 | * bl, bd: number of bits decoded by tl[] and td[] |
456 | */ | 456 | */ |
457 | /* called once from inflate_block */ | 457 | /* called once from inflate_block */ |
458 | |||
459 | /* map formerly local static variables to globals */ | ||
458 | #define ml inflate_codes_ml | 460 | #define ml inflate_codes_ml |
459 | #define md inflate_codes_md | 461 | #define md inflate_codes_md |
460 | #define bb inflate_codes_bb | 462 | #define bb inflate_codes_bb |
diff --git a/libbb/messages.c b/libbb/messages.c index 7f23d4b6d..39bb4c95b 100644 --- a/libbb/messages.c +++ b/libbb/messages.c | |||
@@ -56,4 +56,4 @@ WTMP_FILE; | |||
56 | 56 | ||
57 | char bb_common_bufsiz1[BUFSIZ+1]; | 57 | char bb_common_bufsiz1[BUFSIZ+1]; |
58 | 58 | ||
59 | void *global_ptr; | 59 | void *ptr_to_globals; |