[Toybox] New email, [PATCH] fdisk cleanup, etc.
Isaac
ibid.ag at gmail.com
Sun Aug 11 17:42:37 PDT 2013
fdisk: remove goto; inline valid(); merge xprintf() calls; shrink sys_types
sys_types had used char[_PATH_MAX] for 22-char max strings.
When this is done 48 times, it nearly doubles the size of toybox.
goto should only be used when it is the easiest way to bail out.
That does not mean "when we need to fall back to returning a one-liner
that asks user input", nor is it suitable for looping:
C has while () and do { } while (); for a reason.
valid was called once. As such, it belonged inline.
print_*menu could probably be inlined, but I did not do this yet
in case a table-driven approach works better.
This uses C string concatenation to break an overly long message up,
while not wasting function calls.
--
Leave this part out of the commit message!:
Well, I've been halfway offline for the last 5 days or so,
and you can probably thank the NSA for that ;-)
(I was using lavabit up until they went down for maintenance 2 days before
shutting down. I'd forgotten about this email account until I gave up and
went to gmail.)
In the meanwhile, I looked at fdisk and did a little preliminary research
on cpio. So to make a long story short, I have a bit of cleanup on fdisk.
I also have some code here that *should* handle writing a member of a cpio
newc archive, loopfiles_stdin(), and a general idea of how to proceed.
Don't expect much soon.
(newc is essentially an octal dump of struct stat; oldc differs only in
having a few fields missing or differently sized. cpio is well-suited to
loopfiles, except it reads from stdin.
I'm working on cpio instead of pax because (a) I want to write an initrd,
and (b) pax has a much more complex specification).
There's also a small change I should send for lspci: the -i flag.
And an applet I wrote to resolve the modalias to all matching modules
(resolve_modalias), which is step 0 in getting module autoloading
to work; that will theoretically go into modprobe.
And I would like to go through udhcpc, since it has some abuses of goto.
And the fdisk messages probably need rewriting.
HTH,
Isaac Dunham
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fdisk.diff
Type: text/x-diff
Size: 6052 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130811/966e78a3/attachment-0006.diff>
More information about the Toybox
mailing list