OSDN Git Service

Merge remote-tracking branch 'toybox/master' into HEAD am: f353b240a5 am: 66859184e5
[android-x86/external-toybox.git] / www / cleanup.html
index 998ae09..801dfb8 100644 (file)
@@ -1,3 +1,4 @@
+<html><head><title>toybox cleanup</title></head>
 <!--#include file="header.html" -->
 
 <h1>Index</h1>
@@ -61,21 +62,32 @@ not directly related to a specific cleanup series:</p>
 
 <ul>
 <li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000850.html>Error messages and internationalization.</a></li>
-<li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000891.html>Why not "const"?</a></li>
+<li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000891.html>Why not "const"?</a> (Exception: global variables
+outside of GLOBALS can be static const, to go in rodata instead of data.
+This means the pages can be shared between instances.)</li>
 <li><a href=http://lkml.indiana.edu/hypermail/linux/kernel/1308.3/03890.html>Why not "bool"?</a> (explanation from Linus Torvalds)</li>
 <li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000893.html>Why not to check in debug code.</a></li>
 <li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-June/001044.html>Relationship between /proc and /sys</a> (/proc isn't obsolete and /sys is an ABI)</li>
+<li>"Hiding numbers that are used just once into defines to put them out of
+sight does not really help readability."</a> -
+<a href=http://lkml.iu.edu/hypermail/linux/kernel/1407.1/00299.html>Pavel
+Machek</a></li>
+<li>"Infrastructure in search of a user" is a bad thing, so don't put code
+in lib/ that doesn't already have at least two users. Don't preemptively
+factor stuff out, it's easy enough to rewrite it uin future if it needs
+to change. The "extreme programming" fad called this "You Ain't Gonna
+Need It" (while inexplicably screaming at cans of Mountain Dew, back in the
+90's). Here's <a href=https://lwn.net/Articles/683745/>Linus Torvalds' take</a>.</li>
 </ul>
 
 <hr>
 
 <a name="uuencode"><h1><a href=/hg/toybox/log/900/toys/pending/uuencode.c>uuencode</a></h1>
 
-<p>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:</p>
+<p>This is an example of cleaning up something most projects would be quite
+happy with. The initial submission of uuencode and uudecode was high
+quality code, written by a seasoned developer who did an excellent
+job, but it was still possible to shrink the result almost by half:</p>
 
 <ul>
 <li>old total: <a href=/hg/toybox/file/828/toys/pending/uuencode.c>116 lines (2743
@@ -85,20 +97,22 @@ bytes) in 1 function</a></li>
 </ul>
 
 <ul>
-<li>commit: <a href=/hg/toybox/rev/830>830</a>,
-description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000904.html>part 1</a> and
+<li>commit: <a href=/hg/toybox/rev/830>830</a>: first pass, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000904.html>part 1</a>,
 <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000903.html>part 2</a></li>
 <li>commit: <a href=/hg/toybox/rev/831>831</a>,
-description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000919.html>inline, default Y, move to toys/posix</a></li>
+second pass, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000919.html>part 3</a></li>
 <li>commit: <a href=/hg/toybox/rev/837>837</a>,
-description: test suite.</li>
+description: fix test suite.</li>
+<li>commit: <a href=/hg/toybox/rev/853>853</a>, description: bugfix.</li>
 </ul>
 
 <p>Status: COMPLETE</p>
 
 <a name="uudecode"><h1><a href=/hg/toybox/log/900/toys/pending/uudecode.c>uudecode</a></h1>
 
-<p>I tried to do the uudecode cleanup in smaller stages than uuencode:</p>
+<p>The uudecode cleanup was my second "explain as I go along" cleanup,
+and I tried to do it in smaller stages so it was easier to see what
+changed from the diff:</p>
 
 <ul>
 <li>old: <a href=/hg/toybox/file/828/toys/pending/uudecode.c>175
@@ -111,12 +125,12 @@ lines (4534 bytes) in 9 functions</a></li>
 <li>commit: <a href=/hg/toybox/rev/833>833</a>,
 description: preparatory adjustments to test suite.</li>
 <li>commit: <a href=/hg/toybox/rev/835>835</a>,
-description: todo</a></li>
+description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2014-January/001532.html>Redo command line parsing, redo parsing loop.</a></li>
 <li>commit: <a href=/hg/toybox/rev/838>838</a>,
-description: todo</a></li>
+description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2014-January/001533.html>Redo b64_1byte, b64_4bytes, and uu_line()</a></li>
 <li>commit: <a href=/hg/toybox/rev/839>839</a>,
 description: todo</a></li>
-<li>commit: <a href=/hg/toybox/rev/839>839</a>,
+<li>commit: <a href=/hg/toybox/rev/840>840</a>,
 description: todo (finish, move pending->posix, default y)</a></li>
 </ul>
 
@@ -125,13 +139,15 @@ description: todo (finish, move pending->posix, default y)</a></li>
 <a name=ifconfig>
 <h1><a href=/hg/toybox/log/tip/toys/pending/ifconfig.c>ifconfig</a></h1>
 
+<p>This series describes a thorough cleanup that took a while to do.</p>
+
 <p>When ifconfig was submitted, it touched a half-dozen files. I glued it
 together into a single self-contained file, which needed a lot of
 cleanup. The final version is about 1/3 the size of the original.</p>
 
 <ul>
 <li>old total: <a href=/hg/toybox/file/841/toys/pending/ifconfig.c>1504 lines (44268 bytes) in 38 functions</a></li>
-<li>new total: <a href=/hg/toybox/file/1113/toys/other/ifconfig.c>521 lines (15963 bytes) in 4 function</a></li>
+<li>new total: <a href=/hg/toybox/file/1133/toys/other/ifconfig.c>521 lines (15963 bytes) in 4 functions</a></li>
 </ul>
 
 <p>This was the first command I started cleaning up with the intent of
@@ -161,9 +177,18 @@ description:
 infrastructure cleanup from Isaac Dunham</a>
 (which I mis-applied and then <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000920.html>fixed plus some whitespace changes</a>)</li>
 
-<li>commit: <a href=/hg/toybox/rev/862>862</a>,
-<a href=/hg/toybox/rev/864>864</a>,
-<a href=/hg/toybox/rev/866>866</a>: todo</li>
+<li>commit: <a href=/hg/toybox/rev/862>862</a>, description:
+<a href=http://lists.landley.net/pipermail/toybox-landley.net/2014-January/001525.html>remove unused headers and function, replace local buffer with toybuf, perror_exit(), avoid unnecessary assignment.</a></li>
+<li>commit: <a href=/hg/toybox/rev/864>864</a>, description:
+<a href=http://lists.landley.net/pipermail/toybox-landley.net/2014-January/001526.html>use common linked list functions, inline set_data, add xioctl, clean up error messages, whitespace and comment tweaks, remove NOP return statements</a></li>
+<li>commit: <a href=/hg/toybox/rev/866>866</a>, description:
+<a href=http://lists.landley.net/pipermail/toybox-landley.net/2014-January/001528.html>move standalone globals into GLOBALS() block, collate structs into
+iface_list. Inline/rewrite/remove field_format, iface_flags_str,
+omit_whitespace(), print_iface_flags(), print_media(), get_ifconfig_info(),
+and clear_list(). Merge duplicate function
+calls. Show get_proc_info() version field can't matter in 2.6 or newer kernel,
+and that SIOCGIFMAP has been there since 1994 so doesn't need an #ifdef.
+Loop simplification in readconf() and show_iface().</a></li>
 
 <li>commit: <a href=/hg/toybox/rev/869>869</a> and <a href=/hg/toybox/rev/870>870</a>,
 description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000928.html>869:
@@ -180,8 +205,8 @@ after repeated inlining</a></li>
 <li>commit: <a href=/hg/toybox/rev/883>883</a>,
 description: move some common code to lib/ and posix headers to toys.h.</li>
 <li>commit: <a href=/hg/toybox/rev/898>898</a>,
-description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/000974.html>Replace ifconfig_main() if/else staircase with a loop over
-an array, genericize - prefix logic, inline a use of set_flags().</a></li>
+description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/000974.html>Argument parsing. (Replace ifconfig_main() if/else staircase with a loop over
+an array, genericize minus prefix logic, inline a use of set_flags().)</a></li>
 <li>commit: <a href=/hg/toybox/rev/905>905</a>,
 description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/000992.html>remove unnecessary wrapper function, inlining more functions,
 relying on the values of constants that don't change across architectures
@@ -201,12 +226,12 @@ assignment, trusting -funsigned-char.</a></li>
 <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-June/001027.html>todo whitespace damage, introduce IFREQ_OFFSZ() and poke() to
 ifconfig_main() table logic to fold more if/else parts into the table</a></li>
 <li>Status update: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-June/001033.html>Entering the home stretch on ifconfig</a> (and a <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-June/001043.html>note about infiniband</a>)</li>
-<li>commit: <a href=/hg/toybox/rev/921>921</a>, description: todo</li>
-<li>commit: <a href=/hg/toybox/rev/957>957</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-July/001121.html>here</a></li>
-<li>commit: <a href=/hg/toybox/rev/958>958</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-July/001131.html>here</a></li>
-<li>commit: <a href=/hg/toybox/rev/1104>1104</a>, description: todo</li>
-<li>commit: <a href=/hg/toybox/rev/1127>1127</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-November/001464.html>here</a></li>
-<li>commit: <a href=/hg/toybox/rev/1128>1128</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-November/001463.html>here</a></li>
+<li>commit: <a href=/hg/toybox/rev/921>921</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2014-June/003508.html>Inline a couple more functions and make sockfd a global.</li>
+<li>commit: <a href=/hg/toybox/rev/957>957</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-July/001121.html>Remove unused socklen and addr_to_len(), cleanup so we can merge get_device_info()/display_ifconfig().</a></li>
+<li>commit: <a href=/hg/toybox/rev/958>958</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-July/001131.html>This commit removes struct if_list by unifying get_device_info() and display_ifconfig().</a></li>
+<li>commit: <a href=/hg/toybox/rev/1104>1104</a>, description: Merge toynet into toys.h: musl supports it and micromanaging uClibc config options isn't very interesting anymore.</li>
+<li>commit: <a href=/hg/toybox/rev/1127>1127</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-November/001464.html>Start tacling ipv6 issues, beginning with display_ifconfig().</a></li>
+<li>commit: <a href=/hg/toybox/rev/1128>1128</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-November/001463.html>More ipv6, make struct sockaddr_with_len go away, merge more arguments into the table in main().</a></li>
 <li>commit: <a href=/hg/toybox/rev/1132>1132</a>, description: promotion from pending to other</li>
 <li>commit: <a href=/hg/toybox/rev/1132>1133</a>, description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-November/001462.html>cleanup help text, remove obsolete/NOP commands</a></li>
 </ul>
@@ -237,26 +262,27 @@ description: <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-
 
 <h1><a href=/hg/toybox/log/917/toys/pending/stat.c>stat</a></h1>
 
-<pre>
-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 <a href=/hg/toybox/rev/912>commit</a> <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/001019.html>description</a>
-<a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/001024.html>design pondering</a>
-
- 914 916
-</pre>
+<p>A lot of the stat cleanup was done by Felix Janda.</p>
+
 <ul>
-<li>commit: <a href=/hg/toybox/rev/917>917</a></li>
+<li>commit <a href=/hg/toybox/rev/747>747</a>: initial submission</a></li>
+<li>commit <a href=/hg/toybox/rev/810>810</a>: whitespace</li>
+<li>commit <a href=/hg/toybox/rev/811>811</a>: description in commit message.</li>
+<li>commit <a href=/hg/toybox/rev/871>871</a>: whitespace (reindent from 4 spaces to 2)</li>
+<li>commit <a href=/hg/toybox/rev/872>872</a>: Felix Janda - <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000923.html>cleanup</a> (with discussion thread)</li>
+<li>commit <a href=/hg/toybox/rev/875>885</a>: Felix Janda - <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-April/000936.html>move permission formatting (777 -> -rwxrwxrwx) from ls to lib so stat can reuse it.</a></li>
+<li>commit <a href=/hg/toybox/rev/885>886</a>: Felix Janda - remove unimplemented options and clean up help text</li>
+<li>commit <a href=/hg/toybox/rev/910>910</a>: Felix Janda - <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/001013.html>Add support for stating multiple files</a>.</li>
+<li>commit <a href=/hg/toybox/rev/911>911</a>: Felix Janda - Separate stat and statfs, give stat_main() a ds[2] array to distinguish FLAG_f vs not cases, and some whitespace changes.</li>
+<li>commit <a href=/hg/toybox/rev/912>912</a>: description in commit message (also <a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/001019.html>here</a>)</li>
+<li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-May/001024.html>design pondering</a> (leading to peek() function in lib/)</li>
+
+<li>commit <a href=/hg/toybox/rev/914>914</a>: description in commit message.</li>
+<li>commit <a href=/hg/toybox/rev/916>916</a>: description in commit message.</li>
+<li>commit: <a href=/hg/toybox/rev/917>917</a>: description in commit message.</li>
 <li>commit: <a href=/hg/toybox/rev/918>918</a>,
-description: move to posix, default y.</li>
+description: done: move pending to posix, default y, no other changes</a>.</li>
+<li><a href=http://lists.landley.net/pipermail/toybox-landley.net/2013-June/001026.html>summary</a></li>
 </ul>
 
 <p>Status: COMPLETE.</p>