inline many functions that are only called once. saves about 300 bytes
on i386. also staticify most functions.
diff --git a/archival/bunzip2.c b/archival/bunzip2.c
index fd639a4..356895b 100644
--- a/archival/bunzip2.c
+++ b/archival/bunzip2.c
@@ -320,7 +320,7 @@
0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
};
-void bz_rand_udp_mask(DState *s)
+static void bz_rand_udp_mask(DState *s)
{
if (s->rNToGo == 0) {
s->rNToGo = BZ2_rNums[s->rTPos];
@@ -342,7 +342,7 @@
return(FALSE);
}
-void BZ2_hbCreateDecodeTables(int *limit, int *base, int *perm, unsigned char *length, int minLen, int maxLen, int alphaSize )
+static void BZ2_hbCreateDecodeTables(int *limit, int *base, int *perm, unsigned char *length, int minLen, int maxLen, int alphaSize )
{
int pp, i, j, vec;
@@ -403,7 +403,7 @@
return(TRUE);
}
-int bz_get_fast(DState *s)
+static int bz_get_fast(DState *s)
{
int cccc;
s->tPos = s->tt[s->tPos];
@@ -413,7 +413,7 @@
}
/*---------------------------------------------------*/
-int BZ2_decompress(DState *s)
+static inline int BZ2_decompress(DState *s)
{
int uc = 0;
int retVal;
@@ -1295,7 +1295,7 @@
}
//int BZ2_bzDecompressInit(bz_stream* strm, int verbosity_level, int small)
-int BZ2_bzDecompressInit(bz_stream* strm)
+static inline int BZ2_bzDecompressInit(bz_stream* strm)
{
DState* s;
@@ -1315,7 +1315,7 @@
return BZ_OK;
}
-void bz_seterr(int eee, int *bzerror, bzFile **bzf)
+static void bz_seterr(int eee, int *bzerror, bzFile **bzf)
{
if (bzerror != NULL) {
*bzerror = eee;
@@ -1549,7 +1549,7 @@
/* end save */
}
}
-
+static inline
int BZ2_bzDecompress(bz_stream *strm)
{
DState* s;
@@ -1590,7 +1590,7 @@
return(0); /*NOTREACHED*/
}
-int BZ2_bzRead(int *bzerror, void *b, void *buf, int len)
+static inline int BZ2_bzRead(int *bzerror, void *b, void *buf, int len)
{
int n, ret;
bzFile *bzf = (bzFile*)b;
@@ -1646,7 +1646,7 @@
return(0); /*not reached*/
}
-void *BZ2_bzReadOpen(int *bzerror, FILE *f, void *unused, int nUnused)
+static inline void *BZ2_bzReadOpen(int *bzerror, FILE *f, void *unused, int nUnused)
{
bzFile *bzf = xmalloc(sizeof(bzFile));
int ret;
@@ -1676,7 +1676,7 @@
return bzf;
}
-static unsigned char uncompressStream(FILE *zStream, FILE *stream)
+static inline unsigned char uncompressStream(FILE *zStream, FILE *stream)
{
unsigned char unused[BZ_MAX_UNUSED];
unsigned char *unusedTmp;