aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-09-06 15:28:32 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-09-06 15:28:32 +0000
commit5d725462d44268f9a86030daaa6f6396d32f796c (patch)
tree18a5c1df4fd3bb071bbbac70ece77cb9ef2cea05
parente614eaf40d0b4baad9996e81bcd92ab950111eee (diff)
downloadbusybox-w32-5d725462d44268f9a86030daaa6f6396d32f796c.tar.gz
busybox-w32-5d725462d44268f9a86030daaa6f6396d32f796c.tar.bz2
busybox-w32-5d725462d44268f9a86030daaa6f6396d32f796c.zip
- 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
-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 0c4ab6dda..e2941438c 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -70,22 +70,12 @@ static int block_mode = BLOCK_MODE;
70/* user settable max # bits/code */ 70/* user settable max # bits/code */
71static int maxbits = BITS; 71static int maxbits = BITS;
72 72
73/* Input buffer */
74static unsigned char inbuf[IBUFSIZ + 64];
75
76/* Output buffer */
77static unsigned char outbuf[OBUFSIZ + 2048];
78
79
80static unsigned char htab[HSIZE];
81static unsigned short codetab[HSIZE];
82
83#define htabof(i) htab[i] 73#define htabof(i) htab[i]
84#define codetabof(i) codetab[i] 74#define codetabof(i) codetab[i]
85#define tab_prefixof(i) codetabof(i) 75#define tab_prefixof(i) codetabof(i)
86#define tab_suffixof(i) ((unsigned char *)(htab))[i] 76#define tab_suffixof(i) ((unsigned char *)(htab))[i]
87#define de_stack ((unsigned char *)&(htab[HSIZE-1])) 77#define de_stack ((unsigned char *)&(htab[HSIZE-1]))
88#define clear_htab() memset(htab, -1, sizeof(htab)) 78#define clear_htab() memset(htab, -1, HSIZE)
89#define clear_tab_prefixof() memset(codetab, 0, 256); 79#define clear_tab_prefixof() memset(codetab, 0, 256);
90 80
91 81
@@ -113,6 +103,12 @@ int uncompress(int fd_in, int fd_out)
113 long int maxmaxcode; 103 long int maxmaxcode;
114 int n_bits; 104 int n_bits;
115 int rsize = 0; 105 int rsize = 0;
106 RESERVE_CONFIG_UBUFFER(inbuf, IBUFSIZ + 64);
107 RESERVE_CONFIG_UBUFFER(outbuf, OBUFSIZ + 2048);
108 unsigned char htab[HSIZE];
109 unsigned short codetab[HSIZE];
110 memset(inbuf, 0, IBUFSIZ + 64);
111 memset(outbuf, 0, OBUFSIZ + 2048);
116 112
117 insize = 0; 113 insize = 0;
118 114
@@ -160,7 +156,7 @@ int uncompress(int fd_in, int fd_out)
160 posbits = 0; 156 posbits = 0;
161 } 157 }
162 158
163 if (insize < (int) sizeof(inbuf) - IBUFSIZ) { 159 if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) {
164 rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ); 160 rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
165 insize += rsize; 161 insize += rsize;
166 } 162 }
@@ -286,5 +282,7 @@ int uncompress(int fd_in, int fd_out)
286 write(fd_out, outbuf, outpos); 282 write(fd_out, outbuf, outpos);
287 } 283 }
288 284
285 RELEASE_CONFIG_BUFFER(inbuf);
286 RELEASE_CONFIG_BUFFER(outbuf);
289 return 0; 287 return 0;
290} 288}