On 04/10/2013 01:33:12 AM, Isaac Dunham wrote:
Hello,
First, I'd like to thank Landley for explaining the ifconfig cleanup...

Yay! Glad it was useful.

Would a similar description of the recent uuencode/uudecode cleanup help? That was fairly good code made tighter, so it's a less-obvious cleanup...

Second, I have a small compile-tested patch that applies some of those
points to the mess that is xzcat, and reduces its ifdef forest slightly.

Happily applied. :)

I note that we have existing crc32 code in lib. toys/posix/cksum.c uses crc_init() for example, and does both big endian and little endian crc32. (There are 4 crc32 variants, big endian and little endian with initialization to zero or ~0.) The comment about using the kernel's crc32 made me think it might be possible to share that code...

(I vaguely recall bunzip2 uses crc32 too. The actual crc32 calculation is one line in a tight loop and the function call out to another cache line would probably slow stuff down enough I haven't had the heart to try to put it in lib.c. But the table setup was made generic...)

xzcat is still nearly 2kloc (per sloccount), and still contains far too many ifdefs, defines scattered everywhere, etc. But this removes #ifdef __KERNEL__,
and eliminates the need for #defining XZ_DEC_ANY_CHECK and *CRC64.
I don't have the guts to plunge into untangling the BCJ code just yet, though.

Large cleanups like this are often best handled in stages. I've still got a long way to go on ifconfig, for example. Shortage of time/energy to work on it recently (still recovering from Friday's trip to the hospital, more dental work scheduled thursday, and the timestamp on this message should give you an idea what my sleep schedule is like.)

But I've caught up so I'm only one day behind on email! (Checking the web archive to see what's coming up, sometimes I cherry-pick before I get that far. Balsa's threading is so funky that I'm just reading the unsorted inbox, which means I'm slogging through hundreds of linux-kernel and qemu-devel messages each day...)

I should reeeeally go to bed now.

Thanks again,

Rob
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to