Age | Commit message (Collapse) | Author |
|
This is *much* better (9 kbytes better) than dropping "*const"
optimization trick.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Back in 2007, commit 0c97c9d43707 ("'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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
As it turns out, longjmp'ing into freed stack is not healthy...
function old new delta
unpack_usage_messages - 97 +97
unpack_bz2_stream 369 409 +40
get_next_block 1667 1677 +10
get_bits 156 155 -1
start_bunzip 212 183 -29
bb_show_usage 181 120 -61
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 147/-91) Total: 56 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream dash commit:
Date: Sun, 13 Jul 2008 19:20:10 +0800
Fixed 3,4-argument cases for test per POSIX
----- Forwarded message from Gerrit Pape <pape@smarden.org> -----
Subject: Bug#455828: dash: 4-argument test "test \( ! -e \)" yields an error
Date: Fri, 28 Dec 2007 08:53:29 +0000
From: Gerrit Pape <pape@smarden.org>
To: Vincent Lefevre <vincent@vinc17.org>, 455828@bugs.debian.org
On Thu, Dec 27, 2007 at 06:23:20PM +0100, Vincent Lefevre wrote:
> On 2007-12-27 16:00:06 +0000, Gerrit Pape wrote:
> > On Wed, Dec 12, 2007 at 02:18:47AM +0100, Vincent Lefevre wrote:
> > > According to POSIX[*], "test \( ! -e \)" is a 4-argument test and is
> > > here equivalent to "test ! -e". But dash (like ksh93 and bash) yields
> > > an error:
> > >
> > > $ test \( ! -e \) || echo $?
> > > test: 1: closing paren expected
> > > 2
> > > $ test ! -e || echo $?
> > > 1
> >
> > Hi Vincent,
> >
> > the -e switch to test takes an argument, a pathname.
>
> According to POSIX, in both above examples, "-e" is *not* a switch,
> just a string.
>
> test \( ! -e \)
>
> means: return true if the string "-e" is empty, otherwhise return false.
> The error in dash is that it incorrectly thinks that "-e" is a switch in
> this context.
I see, you're right. Thanks, Gerrit.
----- End forwarded message -----
This patch hard-codes the 3,4-argument cases in the way required by
POSIX.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
test_main 370 421 +51
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Those two spaces after tab have no effect, and always a nuisance when editing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
bb_getgroups - 111 +111
nexpr 843 757 -86
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 111/-86) Total: 25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This makes hash and ash more symmetrical wrt config menu and config
options.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The same can be done for msh, but we are probably better off just deleting it
in a next versio or two.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This also removes their help texts.
function old new delta
run_applet_no_and_exit 442 452 +10
packed_usage 30713 30625 -88
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
test_main 246 350 +104
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
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>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
ops_texts - 124 +124
ops_table - 80 +80
display_process_list 1447 1448 +1
binop 525 523 -2
static.no_op 6 2 -4
check_operator 71 63 -8
ops 240 - -240
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/3 up/down: 205/-254) Total: -49 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
nexpr 826 840 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Also, move [[ ]] comment to test.c and expand it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
nexpr 825 826 +1
tcpudpsvd_main 1830 1822 -8
test_main 257 247 -10
binop 584 525 -59
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 1/-77) Total: -76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
|
|
remove bogus workaround in main(). rename atrocious variables/functions.
much expand testsuite.
libbb: fix --help to not affect "test --help"
function old new delta
run_applet_no_and_exit 421 440 +19
nexpr 817 825 +8
static.no_op - 6 +6
test_main 397 257 -140
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/1 up/down: 104/-211) Total: -107 bytes
|
|
|
|
This time it resulted in small code changes:
function old new delta
nexpr 820 828 +8
tail_main 1200 1202 +2
wrapf 166 167 +1
parse_mount_options 227 209 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18) Total: -7 bytes
|
|
|
|
|
|
|
|
function old new delta
test_main 425 456 +31
t_lex 69 73 +4
syntax 100 104 +4
ptr_to_statics 8 12 +4
t_wp_op 4 - -4
t_wp 4 - -4
ngroups 4 - -4
group_array 4 - -4
binop 590 585 -5
oexpr 104 97 -7
aexpr 101 94 -7
nexpr 831 820 -11
leaving 156 - -156
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 4/4 up/down: 43/-202) Total: -159 bytes
text data bss dec hex filename
775098 929 9084 785111 bfad7 busybox_old
775107 933 8908 784948 bfa34 busybox_unstripped
|
|
|
|
|
|
function old new delta
bb_basename - 26 +26
sv_main 1226 1225 -1
passwd_main 1985 1983 -2
showdirs 482 478 -4
sendCgi 1811 1807 -4
make_device 1354 1350 -4
handleIncoming 2443 2439 -4
func_name 82 78 -4
service_name 2292 2285 -7
main 909 901 -8
cmp_main 555 547 -8
test_main 434 422 -12
act 228 216 -12
find_pair 180 164 -16
rmmod_main 298 280 -18
find_pid_by_name 156 134 -22
modprobe_main 1606 1576 -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 26/-156) Total: -130 bytes
text data bss dec hex filename
734933 3028 14400 752361 b7ae9 busybox_old
734801 3028 14400 752229 b7a65 busybox_unstripped
|
|
<wharms@bfs.de>)
|
|
telnetd: do not use suferfluous static variable.
|
|
function old new delta
test_main 5 434 +429
bb_test 473 - -473
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 429/-473) Total: -44 bytes
text data bss dec hex filename
735073 3028 14408 752509 b7b7d busybox_old
735029 3028 14408 752465 b7b51 busybox_unstripped
|
|
Note that test -f ./exists -a "-u" = "-u" doesn't work and did not work even before r18282, so this is a breakage not caused by me..
|
|
|
|
|
|
|
|
http://busybox.net/lists/busybox/2007-June/027652.html
|