aboutsummaryrefslogtreecommitdiff
path: root/libbb/dump.c
AgeCommit message (Collapse)Author
2020-10-25od: unbreak itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-20hexdump: fix dup block comparisonDenys Vlasenko
function old new delta bb_dump_dump 1523 1520 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-20xxd: fix printing of trailing spacesDenys Vlasenko
function old new delta bb_dump_dump 1497 1523 +26 xxd_main 459 466 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 33/0) Total: 33 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>
2018-07-03hexdump: fix short file of zero butes treated as dupDenys Vlasenko
function old new delta bb_dump_dump 1466 1491 +25 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-06placate gcc-8.0.1 warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05whitespace and comment format fixes, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-02do not use `a' quoting style in commentsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14xxd: allow "-" as file name meaning stdinDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14libbb/dump: allow skipping over stdin tooDenys Vlasenko
function old new delta next 294 265 -29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-14libbb/dump: fix a few broken commits and shrink codeDenys Vlasenko
function old new delta next 310 294 -16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-25libbb: shrink sump.cDenys Vlasenko
function old new delta dot_flags_width_chars - 16 +16 int_convs - 7 +7 lcc 7 - -7 index_str 16 - -16 rewrite 1013 937 -76 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 23/-99) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-25xxd: new appletDenys Vlasenko
Yet Another Hexdumper function old new delta xxd_main - 364 +364 packed_usage 31046 31116 +70 applet_names 2560 2564 +4 applet_main 1476 1480 +4 rewrite 1022 1013 -9 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/1 up/down: 442/-9) Total: 433 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-26hexdump: fix numerous bugs in handling of backslashesDenys Vlasenko
Was: t=48\\ t=45\\ t=4c\\ t=4c\\ t=4f\\ t=0a\\ Now: =48=\n =45=\n =4c=\n =4c=\n =4f=\n =0a=\n Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-27hexdump: don't unconditionally limit the usable address rangeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-18hexdump: fix hexdump -n1 -ve '8/2 ""' SEGV. Closes 4478Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13fix "variable 'foo' set but not used" warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28*: whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-31libbb: add xfstat functionDenys Vlasenko
function old new delta xfstat - 25 +25 mkfs_ext2_main 2421 2423 +2 mkfs_reiser_main 1197 1194 -3 next 312 307 -5 ar_main 533 522 -11 mkfs_minix_main 2938 2924 -14 mkfs_vfat_main 1511 1495 -16 writeTarFile 272 255 -17 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 27/-66) Total: -39 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.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-02-06hexdump: fix "hexdump nonexistent_file" handlingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-18libbb: robustify isXXXX(). +39 bytesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08*: code shrink via NOINLINEDenys Vlasenko
function old new delta expand_vars_to_list - 2118 +2118 lzo1x_optimize - 1429 +1429 run_pipe 358 1775 +1417 arith_apply - 1335 +1335 mainQSort3 - 1198 +1198 logdir_open - 1163 +1163 rewrite - 1039 +1039 dump_identity - 987 +987 do_shm - 884 +884 cpio_o - 863 +863 cpio_main 1450 560 -890 ipcs_main 3442 2523 -919 bb_dump_dump 2611 1488 -1123 process_dev 4572 3405 -1167 logdirs_reopen 1308 86 -1222 arith 2084 707 -1377 mainSort 2622 1202 -1420 do_lzo_compress 2276 799 -1477 run_list 2491 943 -1548 expand_variables 2280 135 -2145 ------------------------------------------------------------------------------ (add/remove: 9/0 grow/shrink: 1/10 up/down: 12433/-13288) Total: -855 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-11-16libbb: replace some memmove's with memcpy's (Ron (ron AT debian.org))Denis Vlasenko
bb_dump_dump 2674 2611 -63
2008-08-23hexdump: fix SEGV in hexdump -e ""Denis Vlasenko
2008-07-29libbb: dump: do not use uninitialized memory. close bug 4364.Denis Vlasenko
2008-07-16libbb: get rid of statics in dump.c; code shrinks a lot tooDenis Vlasenko
function old new delta alloc_dumper - 26 +26 hexdump_main 600 601 +1 static.done 1 - -1 static.ateof 1 - -1 bb_dump_vflag 1 - -1 static.savp 4 - -4 static.nextfs 4 - -4 static.curp 4 - -4 exitval 4 - -4 endfu 4 - -4 bb_dump_length 4 - -4 bb_dump_fshead 4 - -4 bb_dump_blocksize 4 - -4 _argv 4 - -4 bb_dump_add 365 358 -7 savaddress 8 - -8 eaddress 8 - -8 bb_dump_skip 8 - -8 address 8 - -8 bb_dump_dump 2748 2672 -76 next 538 445 -93 ------------------------------------------------------------------------------ (add/remove: 1/16 grow/shrink: 1/3 up/down: 27/-247) Total: -220 bytes text data bss dec hex filename 789458 607 6764 796829 c289d busybox_old 789309 601 6696 796606 c27be busybox_unstripped
2008-07-16od,hexdump: fix bug where xrealloc may move pointer,Denis Vlasenko
leaving other pointers dangling (bug 4104). + many style fixes in libbb/dump.c.
2008-07-08libbb: introduce and use xrealloc_vectorDenis Vlasenko
function old new delta xrealloc_vector_helper - 51 +51 create_list 84 99 +15 getopt_main 690 695 +5 passwd_main 1049 1053 +4 get_cached 85 89 +4 msh_main 1377 1380 +3 add_match 42 41 -1 read_lines 720 718 -2 grave 1068 1066 -2 fill_match_lines 143 141 -2 add_to_dirlist 67 65 -2 add_input_file 49 47 -2 act 252 250 -2 fsck_main 2252 2246 -6 man_main 765 757 -8 bb_internal_initgroups 228 220 -8 cut_main 1052 1041 -11 add_edge_to_node 55 43 -12 dpkg_main 3851 3835 -16 ifupdown_main 2202 2178 -24 sort_main 838 812 -26 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124) Total: -42 bytes
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2008-03-17clean up TODO file. No real code changes.Denis Vlasenko
2008-02-11- spelling fixesBernhard Reutner-Fischer
2007-11-06fbset: fix buglet where we were using wrong pointerDenis Vlasenko
readahead: stop using stdio.h *: style fixes
2007-10-01'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.Denis Vlasenko
263 bytes saved.
2007-08-12trylink: produce even more info about final link stageDenis Vlasenko
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-07-24Replace index_in_[sub]str_array with index_in_[sub]strings,Denis Vlasenko
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-06-21random shrinkage of statics, -60 bytes savedDenis Vlasenko
2007-01-29preparatory patch for -Wwrite-strings #2Denis Vlasenko
2006-12-26style fixesDenis Vlasenko
last xcalloc replaced by xzalloc
2006-12-26leftover of e2fsck surgeryDenis Vlasenko
2006-12-19remove casts from xmalloc()Denis Vlasenko
2006-11-27style cleanup: return(a) -> return a, part 2Denis Vlasenko
2006-11-27style cleanup: return(a) -> return a, part 1Denis Vlasenko
2006-10-27last nail into error_msg() (de)capitalizationDenis Vlasenko
2006-09-06Implement optional syslog logging using ordinaryDenis Vlasenko
bb_xx_msg calls, and convert networking/* to it. The rest of bbox will be converted gradually.
2006-08-03Remove bb_ prefixes from xfuncs.c (and a few other places), consolidateRob Landley
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-07-02Standardize on the vi editing directives being on the first line."Robert P. J. Day"
2006-07-01Remove all usage of the "register" storage class specifier."Robert P. J. Day"
2006-06-28Fix bug http://bugs.busybox.net/view.php?id=874 where hexdump -C got itsRob Landley
spacing wrong.
2006-06-18skip_whitespace() shouldn't claim its return value is const, it doesn't knowRob Landley
that and callers wind up typecasting it back.