[RFC] tail.c size reduction

Tito farmatito at tiscali.it
Sun Sep 2 12:20:53 PDT 2007


Hi to all,
this is a drop in replacement for tail.c.
It is a result of a few sleepless nights of hacking
that started by looking at  and trying 
to understand mjn3's code.
At the end I rewrote tail following a different
italian creative and instinctive way. 
bloat-o-meter is not that bad:

 * scripts/bloat-o-meter busybox_old busybox_unstripped
 * function                                             old     new   delta
 * xmalloc_fgetc                                          -      40     +40
 * .rodata                                           122102  122134     +32
 * header_fmt                                            13       -     -13
 * eat_num                                               37       -     -37
 * tail_read                                            126       -    -126
 * tail_main                                           1109     784    -325
 * ------------------------------------------------------------------------------
 * (add/remove: 1/3 grow/shrink: 1/1 up/down: 72/-501)          Total: -429 bytes 

The functionality should be the same as the original, at least
that is what my little testing says, but as the size reduction
is that big I fear that i've overlooked something very stupid somewhere.
That's why i'm posting it to the list for auditing and inspection by
better coders than me that will see my obvious errors.

Critics, hints, improvements, test cases and flames are, as always, welcome.

Ciao,
Tito

BTW.: Denis, the two test scripts in testsuit/tail are identical as diff tail-n-works tail-works shows.
Maybe one could be removed?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tail.c
Type: text/x-csrc
Size: 7775 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070902/24acad69/attachment.c 


More information about the busybox mailing list