Commit Graph

63 Commits

Author SHA1 Message Date
Denys Vlasenko
6b6826f0b8 *: --help tweaks
function                                             old     new   delta
.rodata                                           103190  103189      -1
packed_usage                                       33590   33566     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25)             Total: -25 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-13 01:08:48 +02:00
James Byrne
6937487be7 libbb: reduce the overhead of single parameter bb_error_msg() calls
Back in 2007, commit 0c97c9d437 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().

This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.

Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.

This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.

The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):

Arm:     -92 bytes
MIPS:    -52 bytes
PPC:   -1836 bytes
x86_64: -938 bytes

Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.

Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02 11:35:03 +02:00
Denys Vlasenko
b097a84d62 config: update size information
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 03:20:17 +01:00
Denys Vlasenko
af5d008669 expr: make it NOEXEC
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-07 23:23:18 +02:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
af3f420116 Convert all coreutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 14:46:56 +01:00
Denys Vlasenko
7373759947 fix "aloc" -> "alloc" typos
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-17 20:58:22 +02:00
Denys Vlasenko
47cfbf32fd *: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:18:48 +02:00
Denys Vlasenko
e6a2f4cc5a libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
The config item is FEATURE_USE_BSS_TAIL. When it is off (default):

function                                             old     new   delta
read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
push                                                  46      44      -2
inetd_main                                          2136    2134      -2
uevent_main                                          421     418      -3
addLines                                              97      92      -5
bb_common_bufsiz1                                   8193    1024   -7169
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181)        Total: -7119 bytes
   text	   data	    bss	    dec	    hex	filename
 829850	   4086	   9080	 843016	  cdd08	busybox_old
 829901	   4086	   1904	 835891	  cc133	busybox_unstripped

FEATURE_USE_BSS_TAIL=y:

read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
inetd_main                                          2136    2134      -2
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195)        Total: -8133 bytes
   text	   data	    bss	    dec	    hex	filename
 829850	   4086	   9080	 843016	  cdd08	busybox_old
 829911	   4086	    880	 834877	  cbd3d	busybox_unstripped

FIXME: setup_common_bufsiz() calls are missing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 17:39:11 +02:00
Denys Vlasenko
16714245f9 add INIT_G()'s. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-21 01:59:15 +02:00
Pere Orga
34425389e0 move help text from include/usage.src.h to coreutils/*.c
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 14:43:25 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
f3ea792bad *: mass cosmetic removal of extra empty lines. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:06:14 +02:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Denys Vlasenko
043b1e5d99 more C standard compat fixes from Dan Fandrich
function                                             old     new   delta
docolon                                              207     204      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 12:47:55 +02:00
Denis Vlasenko
230997bd61 expr: a bit more robust handling of regexps with groups (closes bug 87) 2009-03-03 14:27:36 +00:00
Denis Vlasenko
272710fe93 expr: on error, exit with exitcode 2
expr_main                                            101     110      +9
2008-11-11 22:36:58 +00:00
Denis Vlasenko
a7f4e4bbd8 expr: fix comparisons 'a < b' where we were overflowing a-b
(not to mention that we used int, not arith_t). closes bug 2744.
Also, shrink a bit and add testsuite entry

function                                             old     new   delta
nextarg                                               75      84      +9
tostring                                              38      35      -3
toarith                                               89      86      -3
str_value                                             35      32      -3
eval6                                                555     552      -3
int_value                                             29      23      -6
eval4                                                128     120      -8
eval3                                                112     104      -8
eval2                                                512     417     -95
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 9/-129)           Total: -120 bytes
2008-04-02 20:24:09 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
3952f20c24 expand, unexpand: new applets from Tito <farmatito@tiscali.it> 2007-08-13 14:10:24 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
990d0f63ee Replace index_in_[sub]str_array with index_in_[sub]strings,
which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes.

   text    data     bss     dec     hex filename
 781266    1328   11844  794438   c1f46 busybox_old
 781010    1328   11844  794182   c1e46 busybox_unstripped
2007-07-24 15:54:42 +00:00
Denis Vlasenko
c6753c1666 expr: small code shrink 2007-07-01 18:33:35 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
240a1cfbbe add some missed statics on constant objects.
fix few #ifndef ENABLE_xxx

# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 677152    2920   18208  698280   aa7a8 busybox_old
 676420    2920   18208  697548   aa4cc busybox_unstripped
2007-04-08 16:07:02 +00:00
Bernhard Reutner-Fischer
cea0a8bccb - use bb_error_msg 2007-04-02 17:01:22 +00:00
Bernhard Reutner-Fischer
8025afad8a - use xregcomp. Untested. vda, isn't there a regfree missing here?
text    data     bss     dec     hex filename
   2522       0       0    2522     9da expr.o.r18305
   2478       0       0    2478     9ae expr.o
2007-04-02 16:54:41 +00:00
Bernhard Reutner-Fischer
3c5929a53b - remove some unneeded forward declarations. No obj-code changes. 2007-04-02 16:41:24 +00:00
Bernhard Reutner-Fischer
adb01b1583 - remove args from bss, minor misc shrinkage while at it.
text    data     bss     dec     hex filename
   2577       0       4    2581     a15 expr.o
   2522       0       0    2522     9da expr.o
2007-04-02 16:38:13 +00:00
Denis Vlasenko
cd27c42552 chown: support -H -L -P if ENABLE_DESKTOP
chmod: cosmetic fixes
expr: smallish help for dumb compilers
2007-03-08 13:37:43 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
a41fdf331a preparatory patch for -Wwrite-strings #1 2007-01-29 22:51:00 +00:00
Denis Vlasenko
bf66fbc8e2 introduce LONE_CHAR (optimized strcmp with one-char string) 2006-12-21 13:23:14 +00:00
Denis Vlasenko
d686a045c8 safe_strtoXX interface proved to be a bit unconvenient.
Remove it, introduce saner bb_strtoXX.
Saved ~350 bytes.
2006-11-27 14:43:21 +00:00
Denis Vlasenko
f0ed376eda remove bb_printf and the like 2006-10-26 23:21:47 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Bernhard Reutner-Fischer
73561cc75a - pull from busybox_scratch: r15829:15850
Various fixes, cleanups and shrinkage:
saves 952 Bytes:
   text    data     bss     dec     hex filename
1087742   15853  790632 1894227  1ce753 ../busybox/busybox.old
1086790   15853  790632 1893275  1ce39b busybox
via:
# scripts/bloat-o-meter ../busybox/busybox_unstripped.old busybox_unstripped 
function                                             old     new   delta
ipcrm_main                                           756     822     +66
getval                                                 -      61     +61
maybe_set_utc                                          -      40     +40
udhcpc_main                                         2896    2912     +16
md5_hash_block                                       428     437      +9
opt                                                    8      16      +8
qgravechar                                           106     110      +4
make_bitmap                                          292     295      +3
inflate_unzip                                       2056    2059      +3
add_partition                                       1412    1414      +2
__parsespent                                         156     158      +2
qrealloc                                              41      42      +1
format                                                 -       1      +1
catv_main                                            313     314      +1
watch_main                                           293     292      -1
varunset                                              81      80      -1
part                                                   1       -      -1
check_if_skip                                        837     836      -1
start_stop_daemon_main                               840     837      -3
create_lost_and_found                                175     172      -3
supress_non_delimited_lines                            4       -      -4
static.l                                               4       -      -4
static.c                                               5       1      -4
bsd_sum_file                                         237     233      -4
eval2                                                338     332      -6
arithmetic_common                                    166     158      -8
cmpfunc                                               22       5     -17
cksum_main                                           294     275     -19
cmp_main                                             465     439     -26
dd_main                                             1535    1508     -27
rmmod_main                                           376     333     -43
cut_file                                             727     644     -83
ipcs_main                                           3809    3721     -88
cut_main                                             722     614    -108
date_main                                           1443    1263    -180
remove_ids                                           222       -    -222
------------------------------------------------------------------------------
(add/remove: 3/4 grow/shrink: 11/18 up/down: 217/-853)       Total: -636 bytes
2006-08-28 23:31:54 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
"Robert P. J. Day"
801ab14013 Add one-line GPL boilerplate to numerous (but not all yet) source files. 2006-07-12 07:56:04 +00:00
Eric Andersen
5e678873f9 clean up yet more annoying signed/unsigned mismatches and fixup
yet more incorrect types
2006-01-30 19:48:23 +00:00
"Vladimir N. Oleynik"
8aa9e57149 support 64 arith. Close bug 136 2006-01-25 13:56:03 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
"Vladimir N. Oleynik"
39a841cecf change interface to bb_xasprintf() - more perfect for me.
ln.c: error_msg(str)->error_msg(%s, str) - remove standart "feature" for hackers
reduce 100 bytes don't care in sum
2005-09-29 16:18:57 +00:00
Rob Landley
540d3f60f3 Patch from Shaun Jackman:
> This patch modfies expr to use portable POSIX regex rather than BSD
> regex.
...
> This updated patch implements an anchored regex by checking that the
> match starts at offset 0.

More to the point, this patch uses the same regex that sed.c is already using
(opportunity to suck in less library code), and even building a dynamically
linked busybox with just expr the result is a slightly smaller binary (by 94
bytes, I dunno what nm --size-sort has to say about it because I didn't build
with debug info, since that changes the binary size a lot by disabling
optimization...)

Your mileage may vary.  Handle with caution.  Do not taunt happy fun ball.
2005-05-09 21:42:42 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Manuel Novoa III
083862228a Use bb_xstrdup() instead of strdup(). 2004-02-01 07:34:28 +00:00
Manuel Novoa III
7018385fe7 Be stricter when converting strings to integers. Should fix the problem
reported by Rob.
2004-01-25 19:47:10 +00:00
Glenn L McGrath
07f6b95d8f Patch from Jean Wolter
expr currently always adds even if told to subtract
2003-09-08 23:19:12 +00:00