Age | Commit message (Collapse) | Author |
|
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>
|
|
Testcase: (sleep 10; ls) | busybox less
[...]
~ LICENSE
~ Makefile
~ Makefile.custom
~ Makefile.flags
[...]
less did not want this part:
+ /* dont convert NL to CR+NL on output */
+ newterm->c_oflag &= ~(ONLCR);
function old new delta
get_termios_and_make_raw 108 115 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: James Clarke <jrtc27@jrtc27.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
get_termios_and_make_raw - 139 +139
xget1 39 8 -31
read_line_input 3912 3867 -45
less_main 2525 2471 -54
set_termios_to_raw 116 36 -80
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 139/-210) Total: -71 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
tcsetattr_serial_or_warn - 34 +34
static.int_N_SLIP - 4 +4
restore_state_and_exit 123 117 -6
packed_usage 31774 31747 -27
set_termios_state_or_warn 42 - -42
slattach_main 673 624 -49
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/3 up/down: 38/-124) Total: -86 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
set_termios_to_raw - 116 +116
count_lines 72 74 +2
powertop_main 1458 1430 -28
top_main 943 914 -29
more_main 759 714 -45
fsck_minix_main 2969 2921 -48
conspy_main 1197 1135 -62
rawmode 99 36 -63
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Fedora's "man CMD >file" still uses terminal width, not 80 (but disables formatting),
this change mimics that.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Bartosz Golaszewski proposed xfchdir()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
get_terminal_width - 17 +17
stty_main 1196 1197 +1
pstree_main 321 319 -2
ls_main 735 731 -4
watch_main 232 225 -7
bb_progress_update 714 706 -8
ps_main 555 543 -12
run_applet_and_exit 708 695 -13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 18/-46) Total: -28 byte
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This patch removes stray empty line from busybox code
reported by script find_stray_empty_lines
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This makes "G" (goto end of input) command work as well as
/search_for_nonexistent_string: both will read to EOF now
even from somewhat slow input (such as kernel's "git log").
function old new delta
ndelay_on 35 43 +8
ndelay_off 35 43 +8
read_lines 695 691 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4) Total: 12 bytes
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 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>
|
|
function old new delta
BB_EXECVP_or_die - 47 +47
time_main 1042 1043 +1
chrt_main 371 364 -7
ionice_main 292 282 -10
setsid_main 69 56 -13
nohup_main 236 223 -13
cttyhack_main 266 253 -13
chroot_main 94 81 -13
chpst_main 746 733 -13
timeout_main 297 279 -18
taskset_main 541 522 -19
vfork_child 67 45 -22
parse 975 953 -22
lpd_main 770 748 -22
launch_helper 192 170 -22
tcpudpsvd_main 1810 1782 -28
nice_main 190 156 -34
env_main 242 206 -36
run_command 221 174 -47
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/17 up/down: 48/-352) Total: -304 bytes
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
itoa_to_buf 20 23 +3
utoa_to_buf 117 101 -16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
full_write2_str - 25 +25
full_write1_str - 25 +25
clear_main 21 20 -1
telnet_main 1488 1477 -11
getty_main 1932 1918 -14
full_write22_str 25 - -25
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/3 up/down: 50/-51) Total: -1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
bb_putchar_stderr - 24 +24
ParseField 494 471 -23
progress_meter 212 188 -24
xargs_main 888 842 -46
pipe_progress_main 151 105 -46
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/4 up/down: 24/-139) Total: -115 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
edit_file 671 761 +90
wh_helper - 57 +57
query_screen_dimensions 54 63 +9
ar_main 533 542 +9
refresh 767 773 +6
vi_main 242 243 +1
text_yank 56 54 -2
get_terminal_width_height 180 135 -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/2 up/down: 172/-47) Total: 125 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
hex2bin - 149 +149
in_ib 172 27 -145
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Added O_RDONLY where improves readability. Note: O_RDONLY == 0,
so it is there even if not specified.
function old new delta
stty_main 1289 1235 -54
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Vladimir Dronnikov <dronnikov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
also, move smart_ulltoaN there and comment usage locations
function old new delta
static.unit_chars 7 9 +2
utoa_to_buf 110 108 -2
make_human_readable_str 262 258 -4
fallbackSort 1723 1719 -4
static.fmt 97 92 -5
static.fmt_tenths 10 - -10
static.str 21 4 -17
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/5 up/down: 2/-42) Total: -40 bytes
text data bss dec hex filename
820981 453 6932 828366 ca3ce busybox_old
820968 453 6916 828337 ca3b1 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
ash: small code shrink
text data bss dec hex filename
793669 504 7524 801697 c3ba1 busybox_old
793659 504 7492 801655 c3b77 busybox_unstripped
|
|
function old new delta
...
udhcp_read_interface 225 220 -5
brctl_main 1151 1146 -5
add_interface 109 104 -5
ipaddr_list_or_flush 2174 2167 -7
do_add_ioctl 88 80 -8
vconfig_main 249 240 -9
do_del_ioctl 78 68 -10
do_iplink 1186 1173 -13
do_if_fetch 766 753 -13
buffer_fill_and_print 196 179 -17
parse_args 1709 1684 -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140) Total: -129 bytes
|
|
xx) op
function old new delta
tcsetattr_stdin_TCSANOW - 14 +14
set_sane_term 116 113 -3
top_main 1277 1273 -4
make_new_session 421 415 -6
rawmode 133 126 -7
reset_term 18 10 -8
die 43 35 -8
cookmode 62 54 -8
vlock_main 425 415 -10
read_line_input 3165 3155 -10
bb_askpass 357 347 -10
fsck_minix_main 3079 3065 -14
getty_main 2375 2332 -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131) Total: -117 bytes
|
|
text data bss dec hex filename
808035 611 6868 815514 c719a busybox_old
804472 611 6868 811951 c63af busybox_unstripped
|
|
|
|
|
|
|
|
function old new delta
brctl_main 739 1186 +447
if_indextoname - 104 +104
static.keywords 827 841 +14
static.ops - 7 +7
packed_usage 23978 23976 -2
|
|
*: s/Denis/Denys/
|
|
lpr: more robust error reporting
*: introduce and use xchroot
libbb: full_read/write now will report partial data counts prior to error
isdirectory.c: style fixes
lpd_main 249 486 +237
xchroot - 29 +29
get_response_or_say_and_die 110 139 +29
full_write 52 60 +8
full_read 55 63 +8
static.newline 1 - -1
switch_root_main 404 400 -4
chpst_main 1089 1079 -10
getopt32 1370 1359 -11
chroot_main 115 101 -14
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 4/4 up/down: 311/-40) Total: 271 bytes
text data bss dec hex filename
798472 728 7484 806684 c4f1c busybox_old
798775 728 7484 806987 c504b busybox_unstripped
|
|
text data bss dec hex filename
392 0 0 392 188 lpq.o
1378 0 0 1378 562 lpr.o
142 0 0 142 8e parse_prt.o
|
|
|
|
which sets same handler for many signals. sig_catch is nuked
(bb_signals_recursive is more descriptive name).
*: use them as appropriate.
function old new delta
bb_signals_recursive - 95 +95
bb_signals - 52 +52
run_command 258 273 +15
svlogd_main 1368 1377 +9
runsv_main 1746 1752 +6
runsvdir_main 1643 1646 +3
UNSPEC_print 64 66 +2
time_main 1128 1127 -1
...
resize_main 246 210 -36
sig_catch 63 - -63
set_fatal_sighandler 85 14 -71
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548) Total: -366 bytes
|
|
|
|
*: whitespace fixes
|
|
function old new delta
smart_ulltoa4 - 280 +280
smart_ulltoa5 283 408 +125
ulltoa6_and_space - 25 +25
scale 28 38 +10
bbunpack 358 366 +8
ps_main 259 261 +2
glob3 35 37 +2
fill_bounds 172 174 +2
process_stdin 456 446 -10
smart_ulltoa6 406 - -406
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 6/1 up/down: 454/-416) Total: 38 bytes
|
|
263 bytes saved.
|
|
|
|
|
|
more readable
|
|
smart_ulltoa5: make it more cryptic. -50 bytes.
function old new delta
passwd_main 1095 1103 +8
getNum 557 565 +8
buffer_fill_and_print 73 76 +3
udhcpc_main 2393 2395 +2
mkfs_minix_main 3071 3070 -1
dname_enc 377 373 -4
expmeta 480 472 -8
smart_ulltoa5 334 283 -51
top_main 911 815 -96
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/5 up/down: 21/-160) Total: -139 bytes
text data bss dec hex filename
770872 1063 10788 782723 bf183 busybox_old
770732 1063 10788 782583 bf0f7 busybox_unstripped
|
|
*: fcntl(fd, F_GETFL) doesn't require third parameter at all.
|
|
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is)
remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions
sockaddr2str 142 156 +14
collect_blk 467 474 +7
xdup2 28 33 +5
singlemount 4456 4454 -2
print_host 214 212 -2
nslookup_main 139 137 -2
ftpgetput_main 414 412 -2
udhcpd_main 1258 1255 -3
udhcpc_main 2405 2402 -3
traceroute_main 4125 4122 -3
nc_main 1072 1069 -3
buffer_fill_and_print 76 73 -3
xmalloc_sockaddr2hostonly_noport 18 14 -4
xmalloc_sockaddr2host_noport 18 14 -4
xmalloc_sockaddr2host 15 11 -4
xmalloc_sockaddr2dotted_noport 18 14 -4
xmalloc_sockaddr2dotted 18 14 -4
wget_main 2618 2614 -4
ping_main 393 389 -4
ip_port_str 120 115 -5
dhcprelay_main 1146 1141 -5
dnsd_main 1531 1525 -6
passwd_main 1110 1102 -8
udhcp_kernel_packet 206 197 -9
udhcp_listen_socket 154 144 -10
getty_main 2576 2566 -10
setup 655 640 -15
xmove_fd 51 34 -17
dolisten 759 742 -17
tcpudpsvd_main 1866 1836 -30
startservice 339 299 -40
|
|
|