# HG changeset patch # User Rob Landley # Date 1378443515 18000 # Node ID 2b35f9c797ad097acec5c980a42068500da18ffa # Parent f8824260d0572f3f545d939b2e50476713789c45 Pending cleanup page, less than half done. Some of it should probably move to the code style section. diff -r f8824260d057 -r 2b35f9c797ad www/cleanup.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/cleanup.html Thu Sep 05 23:58:35 2013 -0500 @@ -0,0 +1,192 @@ + + +

Cleaning up the toybox code.

+ +

Toybox +hasn't always taken proper advantage of external contributions. +Lots of people want to help, but their contributions languish out of tree +or in the "pending" directory, awaiting cleanup.

+ +

Toybox's design goals require simpler, tighter, and more explicit code +than most other implementations, among other reasons to allow better security +auditing. Writing "another" implementation of standard command line tools +isn't very interesting, they should be _better_ implementations. +Unfortunately, this means existing, working commands often take more effort to +clean up to Toybox's standards than writing a new one from scratch, not +because they don't work, but because we require an unusual level of polish.

+ +

In hopes of teaching more people how to do this +cleanup work, I've started breaking cleanup changes into smaller chunks and +posting explanations of each change to the mailing list. +Below are indexes of each cleanup series. Line/byte totals of completed +series are given for scale, but the point of this work is simplicity, not +size.

+ +

(Note: mercurial's web viewer doesn't follow renames, so the commit list +links may not show the final version of each file moved from the "pending" +directory to its final location. The summaries link the initial and cleaned +versions of each file when giving line counts.)

+ +
+ +

General advice and/or policy:

+ +

Error messages and internationalization.

+ +

Why not "const"?

+ +

(I leave the Why not "bool"? explanation to Linus Torvalds.)

+ +

Rationale for removing debug code, the interesting bit says:

+

Rule of thumb: other people's debugging printfs are seldom as +useful as your own debugging printfs. Because you know what your output +_means_, and if you can't annotate the code to dump what you need you haven't +read enough of it yet. +

+ +
+ +

uuencode and +uudecode +

+ +

This is an example of cleaning up something +that started in a condition most projects would be quite happy with. +The initial submission of uuencode and uudecode was a good high +quality contribution, written by a seasoned developer who did an excellent +job. It was still possible to shrink uuencode almost by half:

+ + + + + +

Status: COMPLETE

+ +

I tried to do the uudecode cleanup in smaller stages:

+ + + + + +

Status: COMPLETE

+ +

ifconfig

+ +

The largest (ongoing) documented cleanup to date, still in progress:

+ + + +

Status: in progress.

+ +

find

+ +
+814 Initial version by Gurang Shastri.
+815
+816
+847 Felix Janda
+848 Whitespace (reindent from tabs -> 2 spaces)
+849 More cleanup
+867 Felix Janda Improve operator processing.
+874 Felix Janda
+875 Felix Janda
+887 Felix Janda fix -mtime
+
+ + + +

Status: in progress.

+ +

stat

+ +
+747 initial submission
+810 whitespace
+811
+871 whitespace (reindent from 4 spaces to 2)
+872 Felix Janda cleanup
+885 Felix Janda
+  move permission formatting (777 -> -rwxrwxrwx) from ls to lib so stat can reuse it.
+886 Felix Janda remove unimplemented options and clean up help text
+910 Felix Janda Add support for stating multiple files.
+911 Felix Janda Separate stat and statfs.
+912 commit description
+design pondering
+
+ 914 916
+
+ + +

Status: COMPLETE.

+ +