[BusyBox] Patch with clean and remove bugs to m* utils

Erik Andersen andersen at lineo.com
Wed Jan 31 17:47:41 UTC 2001


On Mon Jan 29, 2001 at 12:27:27PM +0300, Vladimir N. Oleynik wrote:
> Patch in attach include
> - mkdir: remove 3 lines in source code.     Status: low
> - mkfs_minix: save 32 bytes, remove 4 bugs. Status: require.
> - mkswap: save 64 bytes, remove 1 bug.      Status: require.

Excellent work.  Applied.

As I was looking over your patch, I began thinking about
how often error_msg_and_die() and error_msg() are used.
Right now, these functions require a terminating \n.   
These functions are used a _lot_ so we could save some
space by putting the \n into error_msg_and_die() and error_msg().

    $ grep error_msg *.c | grep -v perror_msg |wc
	346    2064   21721

If you have a minute, I would be interested to see how much space
we could save by removing all the terminating \n's and adding a 
simple patch such as:

    --- utility.c   2001/01/30 18:03:11     1.194
    +++ utility.c   2001/01/31 17:45:07
    @@ -105,6 +105,7 @@ extern void error_msg(const char *s, ...
	    va_start(p, s);
	    verror_msg(s, p);
	    va_end(p);
    +       write(fileno(stderr), "\n", 1);
     }

     extern void error_msg_and_die(const char *s, ...)
    @@ -114,6 +115,7 @@ extern void error_msg_and_die(const char
	    va_start(p, s);
	    verror_msg(s, p);
	    va_end(p);
    +       write(fileno(stderr), "\n", 1);
	    exit(EXIT_FAILURE);
     }


 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the busybox mailing list