[BusyBox] Function name changes

Mark Whitley markw at lineo.com
Tue Dec 5 22:25:41 UTC 2000


Fellow Busyboxers,

In an effort to bring busybox into compliance with the style guide, I've gone
through utility.c and found some interestinglyNamedFunctions() and am
proposing we change them to differently_named_functions(). I'm not proposing
sweeping changes, mostly just adding some underscores and changing mixed case
names to all lower case. The exceptions to these are fatalError() /
fatalPerror() which are changed to error_msg_and_die() / perror_msg_and_die(),
respectively. (We're all familiar with Perl, right?) The other significant
name change I'm proposing is changing getNum() to get_num_with_multiplier(),
which I think describes what the function does a little better.

The attached file is a Perl script that makes the proposed changes. To execute
it, save it into your busybox directory, chmod +x it, and run it thusly:

	./to_knr.pl *.[ch]

It will magically go through and change old names to new in all files in the
directory. I am happy to report that after running this script on my own box I
was able to do a 'make' and everything compiled (and ran!) cleanly without any
errors.

There are a couple reasons why I attached this script rather than a diff: The
script is 28 lines long, and the diff it generates is 4704 lines long; the
other reason is I want folks to see my proposed changes in a more readable
format so y'all can gimme your comments, feedback, frosty bananas, etc.

Lastly, while it was tempting to write a general-purpose script that could go
through and convert any non K&R string to a K&R string, I resisted that
temptation for a number of reasons: I wanted to propose _targeted_ changes,
rather than scatterfire; I wanted to be able to change function names where I
felt it was appropriate (i.e. getNum -> get_num_with_multiplier), rather than
simply converting possibly poorly-named functions; I wanted to confine the
modifications to a slightly smaller, more managable scope; and lastly I wanted
to propose changes that would have a large effect (lots of programs use the
routines in utility.c) with a lower chance of breaking things.

Submitted for your approval.

Mark Whitley
markw at lineo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: to_knr.pl
Type: application/x-perl
Size: 1040 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20001205/c8d1925f/attachment.bin 


More information about the busybox mailing list