[PATCH] print_flags() take 2: -644 bytes

Natanael Copa natanael.copa at gmail.com
Sat Jun 7 12:47:55 UTC 2008


Hi,

So I collected the ideas/suggestions and prepared another set of patches.

I grouped the masks array with the labels '\0' separated string into a 
struct. They are always used together anyway and by grouping them we 
save one parameter for every call.

Yeah, Linux BSD coding style is great, but its better to be consequent 
so I typedef'ed as requested to fit better in busybox style.

The biggest win is in hdparm, but this time there was a win in both 
fdisk and arp too so i submit pathes for those too.

There are probably more places print_flags() could be used but I could 
not find them.

Bloatcheck on my hardened uclibc x86 gcc-3.4.6:

function                                             old     new   delta
hdparm_main                                         1067    4894   +3827
print_flags_separated                                  -     169    +169
print_flags                                            -      76     +76
.rodata                                            31784   31833     +49
static.ml                                              -       8      +8
static.ultra_modes2                                    -       4      +4
static.ultra_modes1                                    -       4      +4
static.pio_modes                                       -       4      +4
static.labels                                          -       4      +4
static.dma_wmodes                                      -       4      +4
xbsd_print_disklabel                                 927     892     -35
arp_main                                            2474    2439     -35
ipaddr_list_or_flush                                2732    2455    -277
process_dev                                         4446       -   -4446
------------------------------------------------------------------------------
(add/remove: 8/1 grow/shrink: 2/3 up/down: 4149/-4793)       Total: -644 
bytes
   text       data        bss        dec        hex    filename
 135156       2173       4500     141829      22a05    busybox_old
 134540       2361       4500     141401      22859    busybox_unstripped

Thanks!

-nc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print_flags2-arp.patch
Type: text/x-patch
Size: 1246 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080607/caa8509e/attachment-0010.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print_flags2-fdisk.patch
Type: text/x-patch
Size: 1137 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080607/caa8509e/attachment-0011.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print_flags2-hdparm.patch
Type: text/x-patch
Size: 3437 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080607/caa8509e/attachment-0012.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print_flags2-ip.patch
Type: text/x-patch
Size: 1031 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080607/caa8509e/attachment-0013.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print_flags2-libbb.patch
Type: text/x-patch
Size: 1996 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080607/caa8509e/attachment-0014.bin 


More information about the busybox mailing list