[PATCH] reduce des.c static usage from ~70k to 32 bytes

Mike Frysinger vapier at gentoo.org
Mon Mar 19 05:57:30 UTC 2007


On Friday 16 March 2007, Denis Vlasenko wrote:
> Attached patch #1 moves some static variables into des_init(),
> since they are only used there and there's no reason to keep them
> global.
>
> Second patch is moving all non-constant data into malloc space.
> Only two pointer variables and __des_crypt's internal result buffer
> remains in bss:

wonder what's easier ... rewriting all of the code to know that it's using a 
struct, or macroing it away ... aka, doing:
struct crypt_data {
	u_int32_t saltbits;
...
#define saltbits (data_ptr->saltbits)

> # size */*/des.o
>    text    data     bss     dec     hex filename
>    4091       0   70760   74851   12463 uClibc.t0/libcrypt/des.o
>    4491       0      32    4523    11ab uClibc.t2/libcrypt/des.o

very nice
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20070319/e6a4d049/attachment-0002.pgp 


More information about the uClibc mailing list