aboutsummaryrefslogtreecommitdiff
path: root/editors/awk.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * awk: make ltclass ("last token class") local to next_token()Denys Vlasenko2021-06-291-14/+10
| | | | | | | | | | | | | | | | | | | | function old new delta next_token 784 790 +6 next_input_file 219 216 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 6/-3) Total: 3 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: remove redundant checkDenys Vlasenko2021-06-291-14/+18
| | | | | | | | | | | | | | | | | | | | function old new delta next_token 785 784 -1 parse_program 337 328 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-06-281-73/+199
|\|
| * awk: move locals deeper into scopes where they are used, no logic changesDenys Vlasenko2021-06-251-30/+32
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: more efficient -f FILE, document what "some trick in next_token" isDenys Vlasenko2021-06-251-9/+24
| | | | | | | | | | | | | | function old new delta awk_main 890 898 +8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * qwk: make code clearer, no actual code changesDenys Vlasenko2021-06-201-2/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: after preinc/dec, only allow variable, field ref, array ref, or another ↵Denys Vlasenko2021-06-181-18/+69
| | | | | | | | | | | | | | | | | | | | | | preinc/dec Accepting nonsense like "--4", and even "-- -4" is confusing. function old new delta parse_expr 917 938 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix use-after-free in "$BIGNUM1 $BIGGERNUM2" concat opDenys Vlasenko2021-06-161-14/+71
| | | | | | | | | | | | | | | | | | | | Second reference to a field reallocs/moves Fields[] array, but first ref still tries to use the element where it was before move. function old new delta fsrealloc 94 106 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-02-051-3/+15
|\|
| * awk: allow printf('%c') to output NUL, closes 13486Ron Yorston2021-02-021-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-01-141-15/+39
|\|
| * awk: FS regex matches only non-empty separators (gawk compat)Denys Vlasenko2020-12-021-8/+25
| | | | | | | | | | | | | | function old new delta awk_split 484 553 +69 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko2020-11-301-1/+1
| | | | | | | | | | | | | | | | text data bss dec hex filename 1021988 559 5052 1027599 fae0f busybox_old 1021236 559 5052 1026847 fab1f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix dodgy multi-char separators splitting logicDenys Vlasenko2020-11-161-9/+16
| | | | | | | | | | | | | | function old new delta awk_split 521 484 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-07-091-1/+3
|\|
| * awk: disallow "str"++, closes bug 12981Denys Vlasenko2020-06-091-1/+3
| | | | | | | | | | | | | | function old new delta parse_expr 887 896 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-02-151-4/+18
|\|
| * awk: fix more "length" cases, closes 12486Denys Vlasenko2020-02-021-4/+18
| | | | | | | | | | | | | | function old new delta next_token 808 831 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-161-2/+2
|\|
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | win32: add a function to remove CRs from a text bufferRon Yorston2019-02-141-14/+5
| |
* | Merge branch 'busybox' into mergeRon Yorston2019-02-121-10/+31
|\|
| * awk: Fix overly permissive func arg list parsingBrian Foley2019-01-211-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows things like 'func f(a b)' and 'func f(a,)' which GNU awk forbids. function old new delta parse_program 327 367 +40 chain_expr 40 67 +27 parse_expr 891 915 +24 EMSG_TOO_FEW_ARGS 30 18 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 91/-12) Total: 79 bytes Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: Syntax error if delete isn't given an arg.Brian Foley2019-01-211-8/+15
| | | | | | | | | | | | | | | | Unlike exit and return, delete strictly requires an arg, and derefs a null pointer if executed without one. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: Guard pointer chasing when parsing ternary expressions.Brian Foley2019-01-211-1/+2
| | | | | | | | | | | | | | | | | | Avoids an uninit pointer deref for some malformed ternary exprs. Add a test that would crash in busybox before this fix. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | awk: fix handling of regular expressions that match end-of-lineRon Yorston2019-01-231-0/+24
| | | | | | | | | | | | | | | | awk failed to match regular expressions that included an end-of-line: it was looking for a LF whereas lines were terminated by CRLF. Rather than tinker with the regex code or arrange for input to be in text mode I've stripped CRs from the input.
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-1/+1
|\|
| * config: update size informationDenys Vlasenko2018-12-281-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-12-051-0/+2
|\|
| * awk: abort if NF set to negative valueDenys Vlasenko2018-11-281-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-05-131-0/+3
|\|
| * awk: do not allow $(-1)Denys Vlasenko2018-04-231-0/+3
| | | | | | | | | | | | | | | | | | | | function old new delta EMSG_NEGATIVE_FIELD - 25 +25 evaluate 3390 3403 +13 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 38/0) Total: 38 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-02-131-27/+34
|\|
| * awk: code shrinkDenys Vlasenko2018-01-071-4/+3
| | | | | | | | | | | | | | function old new delta awk_main 955 948 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix 'delete array[var--]' decrementing var twiceDenys Vlasenko2018-01-071-23/+31
| | | | | | | | | | | | | | function old new delta evaluate 3395 3390 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-09-271-1/+0
|\|
| * regularize format of source file headers, no code changesDenys Vlasenko2017-09-181-1/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-08-221-2/+6
|\|
| * awk: stop on first non-option, closes 9861Denys Vlasenko2017-08-161-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * do not use `a' quoting style in commentsDenys Vlasenko2017-08-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-291-2/+1
|\|
| * config: trim/improve item names and help texts, take 2Denys Vlasenko2017-07-271-2/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-241-10/+10
|\|
| * config: deindent all help textsDenys Vlasenko2017-07-211-9/+9
| | | | | | | | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libarchive: FEATURE_LZMA_FAST should be visible if FEATURE_SEAMLESS_LZMADenys Vlasenko2017-07-201-1/+1
| | | | | | | | | | | | While at it, tweak some config help texts. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Use %I64* formats with MinGW instead of %ll* formatsJohannes Schindelin2017-07-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The MSVC runtime uses the format specified %I64 for 64-bit data types; It does not understand e.g. %llu for unsigned long longs. However, mingw-w64 provides a compatibility mode in its runtime wrapper which can be activated by defining the constant __USE_MINGW_ANSI_STDIO=1 in which case we must refrain from overriding the %ll* formats. This fixes quite a couple of compile warnings when building with the mingw-w64 compiler. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* | Merge branch 'busybox' into mergeRon Yorston2016-10-261-1/+1
|\|
| * awk: fix segfault on for loop syntax errorBrian Foley2016-10-241-1/+1
| | | | | | | | | | | | | | Parsing "for()" segfaults as awk fails to find loop iteration expressions. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-07-071-6/+2
|\|