[BusyBox] #define -> static const int

Erik Andersen andersen at lineo.com
Fri Jan 5 23:11:31 UTC 2001


On Fri Jan 05, 2001 at 03:19:11PM -0700, Mark Whitley wrote:
> 
> So, I turned a lot of these into:
> 
> 	static const int ARYSIZE = 1024;
> 	static int *ary;
> 
> 	/* ... somewhere near the beginning of applet_main() ... */
> 	ary = xmalloc(sizeof(int)*ARYSIZE);

Which was where the majority (but certainly not all) of the decrease
in bss size comes from.  Not to belittle the static-const-ification
by any means (it is definately a win and is a solid improvement).

I've done such things in a few places, but never been very methodical 
about it.  Excellent work!

> 
> The only files I didn't touch were gzip.c and mkfs_minix.c because they were a
> little too convoluted and will need some more intensive work.

Indeed.  These are both pretty nasty pieces of code...

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the busybox mailing list