summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-09-06 15:28:32 +0000
committerBernhard Reutner-Fischer2006-09-06 15:28:32 +0000
commit5d725462d44268f9a86030daaa6f6396d32f796c (patch)
tree18a5c1df4fd3bb071bbbac70ece77cb9ef2cea05 /archival
parente614eaf40d0b4baad9996e81bcd92ab950111eee (diff)
downloadbusybox-5d725462d44268f9a86030daaa6f6396d32f796c.zip
busybox-5d725462d44268f9a86030daaa6f6396d32f796c.tar.gz
- strip 399424 off the bss by making decompress_uncompress buffers config buffers.
Compile tested (too lazy to look for a small .Z on the net). $ size busybox.old busybox text data bss dec hex filename 859555 10232 645732 1515519 171fff busybox.old 859683 10232 246308 1116223 11083f busybox $ make bloatcheck function old new delta uncompress 1036 1160 +124 inbuf 2116 4 -2112 outbuf 4100 4 -4096 htab 131072 - -131072 codetab 262144 - -262144 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 1/2 up/down: 124/-399424) Total: -399300 bytes
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/decompress_uncompress.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index 0c4ab6d..e294143 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -70,22 +70,12 @@ static int block_mode = BLOCK_MODE;
/* user settable max # bits/code */
static int maxbits = BITS;
-/* Input buffer */
-static unsigned char inbuf[IBUFSIZ + 64];
-
-/* Output buffer */
-static unsigned char outbuf[OBUFSIZ + 2048];
-
-
-static unsigned char htab[HSIZE];
-static unsigned short codetab[HSIZE];
-
#define htabof(i) htab[i]
#define codetabof(i) codetab[i]
#define tab_prefixof(i) codetabof(i)
#define tab_suffixof(i) ((unsigned char *)(htab))[i]
#define de_stack ((unsigned char *)&(htab[HSIZE-1]))
-#define clear_htab() memset(htab, -1, sizeof(htab))
+#define clear_htab() memset(htab, -1, HSIZE)
#define clear_tab_prefixof() memset(codetab, 0, 256);
@@ -113,6 +103,12 @@ int uncompress(int fd_in, int fd_out)
long int maxmaxcode;
int n_bits;
int rsize = 0;
+ RESERVE_CONFIG_UBUFFER(inbuf, IBUFSIZ + 64);
+ RESERVE_CONFIG_UBUFFER(outbuf, OBUFSIZ + 2048);
+ unsigned char htab[HSIZE];
+ unsigned short codetab[HSIZE];
+ memset(inbuf, 0, IBUFSIZ + 64);
+ memset(outbuf, 0, OBUFSIZ + 2048);
insize = 0;
@@ -160,7 +156,7 @@ int uncompress(int fd_in, int fd_out)
posbits = 0;
}
- if (insize < (int) sizeof(inbuf) - IBUFSIZ) {
+ if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) {
rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
insize += rsize;
}
@@ -286,5 +282,7 @@ int uncompress(int fd_in, int fd_out)
write(fd_out, outbuf, outpos);
}
+ RELEASE_CONFIG_BUFFER(inbuf);
+ RELEASE_CONFIG_BUFFER(outbuf);
return 0;
}