[PATCH]passwd: size reduction and clean up

Tito farmatito at tiscali.it
Thu Dec 29 13:14:37 UTC 2005


On Thursday 29 December 2005 13:48, Bernhard Fischer wrote:
> On Thu, Dec 29, 2005 at 01:49:52AM +0100, Tito wrote:
> >Hi,
> >I know that we are in feature freeze, but this patch is trivial...
> >The patch changes:
> >
> >a) getopt -> bb_getopt_ulflags
> >b) fprintf(stderr ... -> bb_error_msg/bb_perror_msg
> >c) some minor hacks to save space.
> >d) adds a GPL license text
> >e) adds some CLEANUP stuff
> >
> >Size reduction is:
> >  text    data     bss     dec     hex filename
> >   3243       0     160    3403     d4b passwd.o.orig
> >   3025       0     160    3185     c71 passwd.o
> >
> >I tested the patch a few times on my box and it worked fine.
> >
> >Please take a look at it and apply or save for 1.2.
> 
> What do you think about the attached further size reduction?
> 
>    text    data     bss     dec     hex filename
>    3159       0     160    3319     cf7 loginutils/passwd.o.oorig
>    2947       0     160    3107     c23 loginutils/passwd.o.tito
>    2871       0     160    3031     bd7 loginutils/passwd.o
Hi, 
the patch compiles fine with gcc-4.0 (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9).
Size reduction for me is:
 text    data     bss     dec     hex filename
   3243       0     160    3403     d4b passwd.o.orig
root at localhost:/dev/pts/0:/root/Desktop/busybox# size loginutils/passwd.o
   text    data     bss     dec     hex filename
   2949       0     160    3109     c25 loginutils/passwd.o    with shadow passports
root at localhost:/dev/pts/0:/root/Desktop/busybox# size loginutils/passwd.o
   text    data     bss     dec     hex filename                         without shadow passports
   2897       0     160    3057     bf1 loginutils/passwd.o

So for me it's ok, let's see what Rob thinks about it....

Ciao,
Tito


> I only compile-tested this with gcc-4.1, so please check with your
> compiler if these help you or not. Perhaps also look if another applet
> uses something like i64c(), we could move it onto a common place then.
> 
> Note how it saves space to reuse the same strings and how reusing the
> block near rename() helps the size, too.
> 
> Also replaced bzero (which is deprecated in favour of memset, nowadays)
> while at it.
> 
> cheers,
> Bernhard
> 



More information about the busybox mailing list