svn commit: trunk/busybox/archival/libunarchive
aldot at busybox.net
aldot at busybox.net
Wed Sep 6 08:28:32 PDT 2006
Author: aldot
Date: 2006-09-06 08:28:32 -0700 (Wed, 06 Sep 2006)
New Revision: 16057
Log:
- 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
Modified:
trunk/busybox/archival/libunarchive/decompress_uncompress.c
Changeset:
Modified: trunk/busybox/archival/libunarchive/decompress_uncompress.c
===================================================================
--- trunk/busybox/archival/libunarchive/decompress_uncompress.c 2006-09-06 13:24:39 UTC (rev 16056)
+++ trunk/busybox/archival/libunarchive/decompress_uncompress.c 2006-09-06 15:28:32 UTC (rev 16057)
@@ -70,22 +70,12 @@
/* 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 @@
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 @@
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 @@
write(fd_out, outbuf, outpos);
}
+ RELEASE_CONFIG_BUFFER(inbuf);
+ RELEASE_CONFIG_BUFFER(outbuf);
return 0;
}
More information about the busybox-cvs
mailing list