aboutsummaryrefslogtreecommitdiff
path: root/miscutils/dc.c
AgeCommit message (Collapse)Author
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
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>
2019-05-16dc: make 4 % 0 emit error messgaes and set result to 0Denys Vlasenko
function old new delta mod 105 136 +31 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-09dc: code shrinkDenys Vlasenko
function old new delta check_under 20 21 +1 print_no_pop 32 27 -5 pop 24 18 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-11) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-08dc: fix "small dc" to have standard command line APIDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-06dc: fix testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-06dc: re-enable "tiny dc" implementationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-05bc: new applet, throws warningGavin Howard
Signed-off-by: Gavin Howard <yzena.tech@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
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-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22Convert all miscutils/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22Split miscutils/Config.src items into miscutils/*.c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21*: add most of the required setup_common_bufsiz() callsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko
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>
2015-05-25dc: fix "dc p" prinitng bogus dataDenys Vlasenko
function old new delta check_under - 20 +20 print_no_pop 27 32 +5 pop 33 24 -9 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 25/-9) Total: 16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12libbb: introduce and use is_prefixed_with()Denys Vlasenko
function old new delta is_prefixed_with - 18 +18 complete_username 78 77 -1 man_main 737 735 -2 fsck_device 429 427 -2 unpack_ar_archive 80 76 -4 strip_unsafe_prefix 105 101 -4 singlemount 1054 1050 -4 rtc_adjtime_is_utc 90 86 -4 resolve_mount_spec 88 84 -4 parse_one_line 1029 1025 -4 parse_conf 1460 1456 -4 may_wakeup 83 79 -4 loadkmap_main 219 215 -4 get_irqs_from_stat 103 99 -4 get_header_cpio 913 909 -4 findfs_main 79 75 -4 fbsplash_main 1230 1226 -4 load_crontab 776 771 -5 expand_vars_to_list 1151 1146 -5 date_main 881 876 -5 skip_dev_pfx 30 24 -6 make_device 2199 2193 -6 complete_cmd_dir_file 773 767 -6 run_applet_and_exit 715 708 -7 uudecode_main 321 313 -8 pwdx_main 197 189 -8 execute 568 560 -8 i2cdetect_main 1186 1176 -10 procps_scan 1242 1230 -12 procps_read_smaps 1017 1005 -12 process_module 746 734 -12 patch_main 1903 1891 -12 nfsmount 3572 3560 -12 stack_machine 126 112 -14 process_timer_stats 449 435 -14 match_fstype 111 97 -14 do_ipaddr 1344 1330 -14 open_list_and_close 359 343 -16 get_header_tar 1795 1779 -16 prepend_new_eth_table 340 323 -17 fsck_main 1811 1794 -17 find_iface_state 56 38 -18 dnsd_main 1321 1303 -18 base_device 179 158 -21 find_keyword 104 82 -22 handle_incoming_and_exit 2785 2762 -23 parse_and_put_prompt 774 746 -28 modinfo 347 317 -30 find_action 204 171 -33 update_passwd 1470 1436 -34 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540) Total: -522 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16dc: tweak parsingBernhard Reutner-Fischer
https://bugs.debian.org/538685 dc requires whitespace between language elements. We were requiring 1 2 + p instead of the abbreviated 1 2+p (for example). function old new delta stack_machine 97 126 +29 dc_main 117 79 -38 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-38) Total: -9 bytes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-18dc: code shrinkDenys Vlasenko
function old new delta stack_machine 103 101 -2 operators 176 168 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-15dc: fix a case where we can run off malloced spaceDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16dc: do not advertise ops disabled in .configDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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-07-29dc: tweak help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-29dc: make it use long longs for integer opsDenys Vlasenko
function old new delta print_base 176 238 +62 or 91 103 +12 eor 91 103 +12 and 91 103 +12 not 60 64 +4 mod 103 105 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/0 up/down: 104/0) Total: 104 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04*: suppress ~60% of "aliased warnings" on gcc-4.4.1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-30dc: make "dc -1.23 ..." workDenys Vlasenko
function old new delta stack_machine 97 103 +6 dc_main 121 110 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 9/-58) Total: -49 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06more C standard compat fixes from Dan FandrichDenys Vlasenko
function old new delta docolon 207 204 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-12-30dc: fix the "base 2" patch omission of base not being setDenis Vlasenko
2008-10-30dc: support for bases 2 and 8, by Nate Case (ncase AT xes-inc.com)Denis Vlasenko
function old new delta print_base 87 176 +89 set_output_base 81 95 +14 static.bases - 5 +5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 108/0) Total: 108 bytes
2008-10-20dc: conditionalize parts which require libmDenis Vlasenko
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-06-25whitespace fixes. no code changesDenis Vlasenko
2008-03-26*: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/Denis Vlasenko
2008-03-17brctl: eliminate stray data objectDenis Vlasenko
brctl: use constant fd to reduce parameter passing runsvdir: do not use data/bss od: reuse bb_argv_dash last: do not go into endless loop on read error mount: make it not fail scripts/find_bad_common_bufsiz check dc: add INIT_G() (no-op for dc, but we want uniform usage of "G trick") function old new delta runsvdir_main 1646 1672 +26 set_pgrp 1 - -1 exitsoon 1 - -1 check 679 678 -1 svnum 4 - -4 svdir 4 - -4 sv 4 - -4 stamplog 4 - -4 rploglen 4 - -4 rplog 4 - -4 mount_main 995 988 -7 static.default_file_list 8 - -8 pfd 8 - -8 logpipe 8 - -8 static.info 20 - -20 brctl_main 767 739 -28 ------------------------------------------------------------------------------ (add/remove: 0/12 grow/shrink: 1/3 up/down: 26/-106) Total: -80 bytes text data bss dec hex filename 793327 662 7412 801401 c3a79 busybox_old 793329 641 7372 801342 c3a3e busybox_unstripped
2008-03-17*: fix various kinds of damage to letter 'c' in Arkadiusz Mickiewicz' surname.Denis Vlasenko
chrt,taskset,dc,eject: shrink crontab: call "vi" with just name, no path watchdog: intercept all fatal signals function old new delta xstrtoull_range - 35 +35 static.sg_commands - 18 +18 packed_usage 23698 23712 +14 watchdog_main 148 151 +3 crontab_main 637 638 +1 base 1 - -1 static.ps 4 - -4 pointer 4 - -4 stack_machine 99 92 -7 run_command 273 260 -13 eject_main 360 343 -17 static.C 30 12 -18 ptok 61 38 -23 xstrtol_range 27 - -27 get_token 35 - -35 taskset_main 586 550 -36 chrt_main 411 372 -39 dc_main 158 117 -41 time_main 1127 1037 -90 ------------------------------------------------------------------------------ (add/remove: 2/5 grow/shrink: 3/9 up/down: 71/-355) Total: -284 bytes text data bss dec hex filename 793680 662 7420 801762 c3be2 busybox_old 793327 662 7412 801401 c3a79 busybox_unstripped
2007-10-11add -fvisibility=hidden to CC flags, mark XXX_main functionsDenis Vlasenko
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-06-04Audit bb_common_bufsiz usage, add script which looks for misuse.Denis Vlasenko
tr: stop using globals needlessly. code: -103 bytes
2007-05-26usage.c: remove reference to busybox.hDenis Vlasenko
*: s/include "busybox.h"/include "libbb.h"
2007-04-10- use skip_non_whitespace() where appropriateBernhard Reutner-Fischer
2007-03-24dc: use common_bufsiz1 for evaluation stackDenis Vlasenko
msh: fix "underscore bug" (a_b=1111 didn't work) dnsd: openlog(), so that applet's name is logged
2007-02-03suppress warnings about easch <applet>_main() havingDenis Vlasenko
no preceding prototype
2006-10-25use skip_whitespace where appropriateDenis Vlasenko
2006-10-12bb_get_[chomped]line_from_file wasn't descriptive enough.Denis Vlasenko
Renaming...
2006-10-08attempt to regularize atoi mess.Denis Vlasenko
2006-07-12Add one-line GPL boilerplate to numerous (but not all yet) source files."Robert P. J. Day"
2006-06-03- remove superfluous call of stack_machine(0) upon exit.Bernhard Reutner-Fischer
2006-06-03- move #include busybox.h to the very top so we pull in the configBernhard Reutner-Fischer
and eventual platform specific includes in early.
2004-07-24Patch by Paul Whittaker, make busybox dc compatable with GNU dc. Glenn L McGrath
the following example was broken, echo "1 1 +" | dc
2004-03-15Remove trailing whitespace. Update copyright to include 2004.Eric Andersen
2003-10-22Goetz Bock writes:Eric Andersen
Dear list, during my quest do pack busybox into an RPM, I've fixed a small bug (missing \n) in dc's usage. And added two additional operations: mod and exp/power. Feel free to drop them.
2003-08-28"Typo and/or thinko: scanning till the end of NUL terminated stringGlenn L McGrath
should check the byte pointed at not the pointer itself." -junkio@
2003-03-19Major coreutils update.Manuel Novoa III