Commit Graph

122 Commits

Author SHA1 Message Date
Rob Landley
d8205b39ab awk: reduce ifdef forest
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 03:27:22 +02:00
Denys Vlasenko
2b299fed6a awk: fix breakage in last commit
While at it, made bb_process_escape_sequence faster (same size)

function                                             old     new   delta
nextchar                                              49      53      +4
bb_process_escape_sequence                           138     140      +2
next_token                                           838     839      +1
static.charmap                                        20      18      -2
is_assignment                                        143     135      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 7/-10)              Total: -3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 01:58:04 +02:00
Denys Vlasenko
6a0d7490ea awk: fix segfault on closing non-opened file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-23 21:02:15 +02:00
Denys Vlasenko
28458c64db awk: code shrink
function                                             old     new   delta
fsrealloc                                            112     107      -5
next_token                                           862     844     -18

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-05 16:49:03 +02:00
Denys Vlasenko
d527e0c81d awk: 00.123 is not a octal constant; neither is 009.123. fixing this
function                                             old     new   delta
my_strtod                                             80     113     +33

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-05 13:22:11 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
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-08-16 20:14:46 +02:00
Denys Vlasenko
7379cd1ca1 awk: add comment about fixing bug 1333
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 01:48:12 +02:00
Denys Vlasenko
fab288cf0b awk: don't append bogus data after NUL in sub(); shrink
also renamed variables to more sensible names

function                                             old     new   delta
mk_re_node                                            56      49      -7
awk_sub                                              601     591     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 01:17:30 +02:00
Denys Vlasenko
f9782ffc45 awk: code shrink
function                                             old     new   delta
evaluate                                            3550    3487     -63

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:32:13 +01:00
Denys Vlasenko
c6ba997978 awk: code shrink
function                                             old     new   delta
hash_find                                            233     234      +1
evaluate                                            3899    3550    -349

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:05:09 +01:00
Denys Vlasenko
7b81db1379 awk: style fixes
function                                             old     new   delta
hash_find                                            234     233      -1
awk_printf                                           457     453      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:04:47 +01:00
Denys Vlasenko
39fe4d1599 awk: code shrink
function                                             old     new   delta
exec_builtin                                        1538    1489     -49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 16:57:06 +01:00
Denys Vlasenko
b0a57abb79 awk: code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:44:25 +01:00
Denys Vlasenko
6ebdf7aa7b awk: code shrink; style fixes
function                                             old     new   delta
next_token                                           932     862     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:41:55 +01:00
Denys Vlasenko
da62b09ab1 awk: be more paranoid when freeing loop variable; make code less obfuscated
function                                             old     new   delta
nvfree                                               149     170     +21
next_token                                           928     932      +4
getvar_i                                              95      94      -1
skip_spaces                                           51      45      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 25/-7)              Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:13:18 +01:00
Denys Vlasenko
c9955f23a2 awk: simple code shrink
function                                             old     new   delta
awk_getline                                          710     724     +14
awk_printf                                           455     457      +2
hash_find                                            234     233      -1
qrealloc                                              33      31      -2
handle_special                                       499     482     -17
awk_sub                                              641     601     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/4 up/down: 16/-60)            Total: -44 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-10 19:21:54 +01:00
Denys Vlasenko
3cb60c3973 awk: fix the case where nested "for" loops with the same variable misbehave
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-10 19:20:32 +01:00
Alexander Shishkin
d03cd3be24 awk: skip whitespace between array name and subscript
It is supported in both mawk and gawk and there are actually scripts
out there that use this "flexibility".

function                                             old     new   delta
next_token                                          1144    1152      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0)                 Total: 8 bytes

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 08:48:56 +01:00
Denys Vlasenko
3dbc5a9742 awk: remove wrong comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-05 14:54:22 +01:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Denys Vlasenko
1284774d60 awk: fix an incorrect casting to string (bug 725). -44 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-30 01:15:04 +01:00
Denys Vlasenko
cdeda16ee4 awk: preparatory patch, no essential code changes. -13 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-30 01:14:16 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00
Denys Vlasenko
56b3eec162 small optimizations of toupper/tolower
function                                             old     new   delta
in_ib                                                191     172     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 13:03:59 +02:00
Denys Vlasenko
7bb346f23c *: use {i,u}toa() where appropriate
function                                             old     new   delta
startservice                                         377     363     -14
setari_u                                              54      40     -14
ash_main                                            1375    1361     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-42)             Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-06 22:09:50 +02:00
Denys Vlasenko
bc3e9479c2 awk: fix typo in prev commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 04:16:00 +02:00
Leonid Lisovskiy
46a0be5304 awk: implement mktime
function                                             old     new   delta
exec_builtin                                           -    1466   +1466
do_mktime                                              -     116    +116
tokenlist                                            441     448      +7
tokeninfo                                            396     400      +4
evaluate                                            5395    3755   -1640
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/1 up/down: 1593/-1640)        Total: -47 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-21 04:08:08 +02:00
Denys Vlasenko
d069e5398d a few more GCC-isms removed
text    data     bss     dec     hex filename
 824641     458    6956  832055   cb237 busybox_old
 824631     458    6956  832045   cb22d busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-09 23:12:10 +02:00
Denys Vlasenko
90a9904e9e remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
logdirs_reopen                                      1310    1308      -2
read_line_input                                     4757    4753      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:36:23 +02:00
Denys Vlasenko
e424423a7b awk: put at least one NUL between $n. Hopefully closes 337.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-18 23:50:03 +02:00
Denis Vlasenko
c7cc5a9432 mdev: Rob's #if forest removal
*: remove superfluous conts in "f(type *const param)"
2009-04-19 01:27:20 +00:00
Denis Vlasenko
67b5eeb933 awk: fix long field separators case. By Ian Wienand (ianw AT vmware.com) 2009-04-12 13:54:13 +00:00
Denis Vlasenko
7a6766428e awk: fix compat issue found by gpm build
function                                             old     new   delta
as_regex                                             105     131     +26
hash_find                                            247     233     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 26/-14)             Total: 12 bytes
2009-03-15 22:20:31 +00:00
Denis Vlasenko
9aa5c652e9 unzip: fix thinko with le/be conv and size (closes bug 129)
awk: make "struct global" hack more robust wrt alignment (closes bug 131)
2009-02-26 11:21:04 +00:00
Denis Vlasenko
41d5ebee17 awk: in BEGIN section $0 should be "", not "0". 2009-01-25 01:00:15 +00:00
Denis Vlasenko
2d5bd807c0 build system cleanup: rename FEATURE_AWK_MATH to FEATURE_AWK_LIBM;
disable parsing test applet.
2008-10-24 10:49:49 +00:00
Denis Vlasenko
37890e2f37 awk: fix typo in atan2 code. closes bug 5594. 2008-10-21 12:59:34 +00:00
Denis Vlasenko
665eaff3b1 awk: add a comment 2008-09-05 04:59:02 +00:00
Denis Vlasenko
a2e1eea189 awk: improve nadling of negative numbers in bitwise ops;
fix handling of octal costants. add test for it

function                                             old     new   delta
getvar_i_int                                           -      93     +93
my_strtod                                              -      84     +84
qrealloc                                              33      36      +3
getvar_i                                              99      95      -4
next_token                                           979     919     -60
evaluate                                            6359    5627    -732
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/3 up/down: 180/-796)         Total: -616 bytes
2008-09-02 09:00:23 +00:00
Denis Vlasenko
7cbcd1cbf4 awk: bitwise ops cast oprands and results to unsigned long,
not signed. closes 4774.
2008-08-28 23:16:58 +00:00
Denis Vlasenko
996a61475a awk: support hex constants 2008-08-28 22:59:23 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Denis Vlasenko
deeed59de0 libbb: introduce and use xrealloc_vector
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-07-08 05:14:36 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
8ae5b28b4b awk: another smallish code shrink 2008-07-02 22:47:49 +00:00
Denis Vlasenko
e0a7fc54eb uname,individual: fix improper printf usage
uname,awk: small code shrink

function                                             old     new   delta
uname_main                                           175     166      -9
nvalloc                                              167     157     -10
evaluate                                            6381    6370     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-30)             Total: -30 bytes
2008-07-02 11:14:59 +00:00
Denis Vlasenko
3bb2bbd684 awk: fix a case with multiple -f options. simplify -f file reading.
function                                             old     new   delta
parse_expr                                           833     841      +8
qrealloc                                              33      36      +3
next_input_file                                      203     198      -5
afopen                                                22       -     -22
ftello                                                41       -     -41
ftell                                                 41       -     -41
__GI_ftell                                            41       -     -41
awk_main                                            1002     944     -58
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 2/2 up/down: 11/-208)          Total: -197 bytes
   text    data     bss     dec     hex filename
 804232     610    6804  811646   c627e busybox_old
 804120     610    6804  811534   c620e busybox_unstripped
2008-07-01 01:57:36 +00:00
Denis Vlasenko
77ad97f199 more -Wall warning fixes from Cristian Ionescu-Idbohrn.
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
2008-05-13 02:27:31 +00:00
Denis Vlasenko
574f2f4394 *: add optimization barrier to all "G trick" locations 2008-02-27 18:41:59 +00:00
Denis Vlasenko
847fa779af *: tidy up usage of char **environ 2008-01-28 22:45:43 +00:00