Commit Graph

217 Commits

Author SHA1 Message Date
Denys Vlasenko
651a2697f7 *: merge some common strings
text   data    bss    dec    hexfilename
 838650   8009      0 846659  ceb43busybox_old
 838519   8009      0 846528  ceac0busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 16:25:17 +01:00
Denys Vlasenko
36659fda1f *: fix 1/4 remaining aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-05 14:40:23 +01:00
Denys Vlasenko
6b9f163353 *: style fixes. no code changes (verified with objdump)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28 02:24:24 +01:00
Denys Vlasenko
ffc4bced95 libiproute: eliminate unused fields in struct filter_t's; style fixes
function                                             old     new   delta
print_route                                         1603    1588     -15
iproute_list_or_flush                               1254    1230     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39)             Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-26 11:03:16 +01:00
Denys Vlasenko
9037787eae *: fix places where we were still using malloc/realloc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-08 09:07:50 +01:00
Denys Vlasenko
a355da0775 *: make 2 more "int argc"'s unused; more saved if !DESKTOP
function                                             old     new   delta
sync_main                                             18      20      +2
tty_main                                              90      87      -3
iprule_list                                           83      79      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 13:16:08 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +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
d31575a3ae libiproute/*: code shrink
function                                             old     new   delta
ll_addr_a2n                                          181     178      -3
rtnl_rtntype_a2n                                     198     194      -4
ipaddr_modify                                       1309    1305      -4
print_addrinfo                                      1303    1298      -5
do_iplink                                           1137    1132      -5
print_route                                         1609    1603      -6
parse_args                                          1440    1434      -6
iproute_list_or_flush                               1261    1254      -7
rtnl_rttable_a2n                                      39      31      -8
rtnl_rtscope_a2n                                      39      31      -8
rtnl_rtrealm_a2n                                      39      31      -8
rtnl_rtprot_a2n                                       39      31      -8
rtnl_dsfield_a2n                                      39      31      -8
ll_type_n2a                                           78      70      -8
get_rt_realms                                        115     107      -8
print_tunnel                                         656     647      -9
rtnl_rttable_n2a                                      63      53     -10
rtnl_rtscope_n2a                                      63      53     -10
rtnl_rtrealm_n2a                                      63      53     -10
rtnl_rtntype_n2a                                     128     118     -10
rtnl_dsfield_n2a                                      71      61     -10
print_linkinfo                                       815     805     -10
ipaddr_list_or_flush                                1246    1235     -11
iproute_modify                                      1048    1036     -12
iprule_modify                                        866     851     -15
print_rule                                           765     738     -27
ll_addr_n2a                                          182     150     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/27 up/down: 0/-262)          Total: -262 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-13 17:58:24 +02:00
Denys Vlasenko
94466b8b8c libiproute: code and data shrink
function                                             old     new   delta
rtnl_a2n                                               -     126    +126
ll_remember_index                                    233     263     +30
find_by_index                                         26      36     +10
rtnl_rtprot_initialize                                66      70      +4
static.unit_chars                                      7       9      +2
rtnl_rttable_initialize                               73      75      +2
rtnl_rtscope_initialize                               83      85      +2
rtnl_rtrealm_initialize                               43      45      +2
rtnl_rtdsfield_initialize                             43      45      +2
rtnl_rttable_n2a                                      62      63      +1
rtnl_rtscope_n2a                                      62      63      +1
rtnl_rtrealm_n2a                                      62      63      +1
rtnl_dsfield_n2a                                      70      71      +1
ll_init_map                                           36      33      -3
make_human_readable_str                              262     258      -4
static.fmt                                            97      92      -5
static.fmt_tenths                                     10       -     -10
static.str                                            21       4     -17
static.res                                            20       -     -20
static.cache                                          24       4     -20
idxmap                                                64       4     -60
rtnl_rttable_a2n                                     154      39    -115
rtnl_rtscope_a2n                                     159      39    -120
rtnl_rtrealm_a2n                                     159      39    -120
rtnl_rtprot_a2n                                      159      39    -120
rtnl_dsfield_a2n                                     162      39    -123
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 12/11 up/down: 184/-737)       Total: -553 bytes
   text           data            bss            dec            hex        filename
 820376            445           7668         828489          ca449        busybox_old
 819950            445           7548         827943          ca227        busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-13 16:27:11 +02:00
Denys Vlasenko
adf922ec28 *: a few more NOINLINEs
function                                             old     new   delta
print_linkinfo                                         -     815    +815
do_msg                                                 -     783    +783
INET_setroute                                          -     757    +757
varvalue                                               -     746    +746
do_sem                                                 -     637    +637
inflate_codes                                          -     617    +617
INET6_setroute                                         -     491    +491
edir                                                   -     370    +370
sync_cursor                                            -     298    +298
update_utmp                                            -     246    +246
searchLines                                            -     165    +165
setup_alarm                                            -     144    +144
may_wakeup                                             -     101    +101
getNum                                               566     371    -195
refresh                                             1166     848    -318
rtcwake_main                                         809     479    -330
getty_main                                          2396    1921    -475
chpst_main                                          1373     746    -627
inflate_unzip_internal                              1335     567    -768
evalvar                                             1384     612    -772
ipaddr_list_or_flush                                2160    1246    -914
route_main                                          1585     245   -1340
ipcs_main                                           2523    1049   -1474
------------------------------------------------------------------------------
(add/remove: 13/0 grow/shrink: 0/10 up/down: 6170/-7213)    Total: -1043 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 14:35:37 +02:00
Denys Vlasenko
fd2dc53ba4 remove useless (unsigned >= 0) comparison
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-04 01:13:35 +02:00
Denys Vlasenko
1f27ab0d4b *: optimize code size in strtoul calls
function                                             old     new   delta
bb_parse_mode                                        433     431      -2
rtnl_rtntype_a2n                                     202     198      -4
ParseField                                           511     498     -13
bb_init_module_24                                   4730    4675     -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74)             Total: -74 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 17:17:53 +02:00
Denys Vlasenko
d5f1b1bbe0 *: add FAST_FUNC to function ptrs where it makes sense
function                                             old     new   delta
evalcommand                                         1195    1209     +14
testcmd                                                -      10     +10
printfcmd                                              -      10     +10
echocmd                                                -      10     +10
func_exec                                            270     276      +6
echo_dg                                              104     109      +5
store_nlmsg                                           85      89      +4
pseudo_exec_argv                                     195     198      +3
dotcmd                                               287     290      +3
machtime_stream                                       29      31      +2
discard_stream                                        24      26      +2
argstr                                              1299    1301      +2
killcmd                                              108     109      +1
evalfor                                              226     227      +1
daytime_stream                                        43      44      +1
run_list                                            2544    2543      -1
lookupvar                                             62      61      -1
ipaddr_modify                                       1310    1309      -1
...
parse_stream                                        2254    2245      -9
evalpipe                                             356     347      -9
collect_if                                           210     197     -13
read_opt                                             869     851     -18
handle_dollar                                        681     658     -23
print_addrinfo                                      1342    1303     -39
iterate_on_dir                                       156      59     -97
print_route                                         1709    1609    -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767)       Total: -693 bytes
   text    data     bss     dec     hex filename
 841748     467    7872  850087   cf8a7 busybox_old
 841061     467    7872  849400   cf5f8 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 12:06:05 +02:00
Denis Vlasenko
a771e7c005 *: remove check for errors on getsockaddr in cases we know they can't happen
libbb: make get_sock_lsa use only one getsockaddr syscall, not two

function                                             old     new   delta
get_sock_lsa                                          72     101     +29
do_iplink                                           1151    1137     -14
arping_main                                         1585    1569     -16
dolisten                                             789     755     -34
xrtnl_open                                           161      94     -67
2009-04-21 23:48:38 +00:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00: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
f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Denis Vlasenko
76140a77c9 networking/libiproute/*: code shrink by optimizing numeric conversions
and other misc stuff

function                                             old     new   delta
print_tunnel                                         660     656      -4
format_host                                            5       -      -5
get_unsigned                                          70      54     -16
get_u32                                               70      54     -16
do_iplink                                           1173    1151     -22
get_prefix                                           417     393     -24
print_rule                                           800     771     -29
print_addrinfo                                      1374    1342     -32
print_route                                         1745    1709     -36
iprule_modify                                        905     866     -39
iproute_modify                                      1105    1048     -57
get_integer                                           70       -     -70
parse_args                                          1684    1440    -244
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/11 up/down: 0/-594)          Total: -594 bytes
   text    data     bss     dec     hex filename
 817378     476    7892  825746   c9992 busybox_old
 816784     476    7892  825152   c9740 busybox_unstripped
2009-03-05 09:21:57 +00:00
Denis Vlasenko
787a492f23 ip: in "ip rule add from all table 1", "all" is taken as 0.0.0.0/32,
whereas "any" and "default" would be 0.0.0.0/0. They must be all 0.0.0.0/0.
Closes bug 57.
2009-03-03 14:55:29 +00:00
Denis Vlasenko
12abcb36c8 libiproute: fix buggy open check: s/if (fd)/if (fd >= 0)/
less: small optimization -15 bytes
2008-12-10 14:14:09 +00:00
Denis Vlasenko
efb545b9bd optimize 16- and 32-bit moves
function                                             old     new   delta
udhcpd_main                                         1239    1257     +18
udhcp_add_simple_option                               93      92      -1
buffer_read_le_u32                                    19      18      -1
unpack_gz_stream_with_info                           526     520      -6
dnsd_main                                           1470    1463      -7
udhcp_run_script                                    1208    1186     -22
send_ACK                                             255     229     -26
arping_main                                         1661    1623     -38
send_offer                                           470     428     -42
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/8 up/down: 18/-143)          Total: -125 bytes
2008-12-08 22:56:18 +00:00
Denis Vlasenko
196a953f21 iptunnel: fix problems with including linux/ip_tunnel.h
on some systems
2008-12-03 20:16:11 +00:00
Denis Vlasenko
360d9661b6 libbb: add strncpy_IFNAMSIZ
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
2008-12-02 18:18:50 +00:00
Denis Vlasenko
44d5dcebc6 iplink: accept shorthands for "address" keyword here:
"ip link set address 00:11:22:33:44:55"
ifupdown: use "addr" instead of "address"
2008-11-01 00:10:51 +00:00
Bernhard Reutner-Fischer
470dc1d7e2 - minor shrinkage (~-60) 2008-10-30 17:42:49 +00:00
Bernhard Reutner-Fischer
e29186687b - support ip link set eth1 address 00:11:22:33:44:55
and not only the shorthand "addr". Thanks to ncopa for noticing
2008-10-30 16:45:55 +00:00
Bernhard Reutner-Fischer
8fbd8ac8dd - fix ip route rejecting dotted quads as prefix
- adjust error message for wrong prefix not to mention address
  Previously e.g. ip route add 127.0.0.0/255.0.0.0 dev dummy0
  was rejected, saying
ip: an inet address is expected rather than "127.0.0.0/255.0.0.0"
 
function                                             old     new   delta
get_prefix_1                                         201     309    +108
get_prefix                                            55      73     +18
get_addr                                              55      73     +18
get_addr32                                            48      58     +10
get_addr_1                                           249     204     -45
.rodata                                           114569  114524     -45
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 154/-90)            Total: 64 bytes
2008-10-21 12:42:45 +00:00
Bernhard Reutner-Fischer
578de8644c - route metric support (Natanael Copa)
Adds about 75b
2008-10-07 17:00:58 +00:00
Bernhard Reutner-Fischer
6c4dadefb6 - update my name. No obj-code changes ;) 2008-09-25 12:13:34 +00:00
Denis Vlasenko
1c781cc8ff modprobe-small: make insmod command line compatible
function                                             old     new   delta
modprobe_main                                        326     435    +109
moderror                                               -      52     +52
process_module                                       577     530     -47
2008-09-06 14:14:01 +00:00
Bernhard Reutner-Fischer
0901c51518 - add WIP stub for tc.
Printing worked at some point. Modify/Delete needs some refacturing.
2008-09-04 13:22:58 +00:00
Denis Vlasenko
084266ed52 fix several problems with config parser:
a bug where it underflows the string
 a bug where it never frees parser_t struct
make read_config() return 0 if parser is NULL,
 make config_close() accept and ignore NULL parser -
 eliminates many if() blocks
reverse the sense of parser bit flags - negative flags
 are harder to grok.
hexdump: revert the change to use config parser, it is BIGGER
 and also requires additional quirks in parser
*: explicitly use PARSER_NORMAL instead of 0

function                                             old     new   delta
login_main                                          1575    1596     +21
config_close                                          18      29     +11
bbunpack                                             383     391      +8
qgravechar                                           106     109      +3
rtnl_tab_initialize                                  121     117      -4
expand                                              1697    1693      -4
man_main                                             717     712      -5
nameif_main                                          674     668      -6
hexdump_main                                         597     591      -6
read_config                                          217     209      -8
dnsd_main                                           1478    1470      -8
sysctl_main                                          203     189     -14
config_open2                                          44      25     -19
make_device                                         1177    1141     -36
config_read                                          597     549     -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/11 up/down: 43/-158)         Total: -115 bytes
2008-07-26 23:08:31 +00:00
Denis Vlasenko
0f99d49ae6 *: conversion to config parser
function                                             old     new   delta
config_read                                          540     597     +57
config_open2                                          41      44      +3
rtnl_rtprot_initialize                                70      66      -4
rtnl_rttable_initialize                               78      73      -5
rtnl_rtscope_initialize                               88      83      -5
rtnl_rtrealm_initialize                               48      43      -5
rtnl_rtdsfield_initialize                             48      43      -5
process_module                                       566     560      -6
bbunpack                                             391     383      -8
rtnl_tab_initialize                                  279     121    -158
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/8 up/down: 60/-196)          Total: -136 bytes
2008-07-24 23:38:04 +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
Bernhard Reutner-Fischer
d73cbd31a2 - first pass to unify/cleanup uid handling (-236b)
This needs further love, alot of love.. Tito?
2008-07-21 14:41:33 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
0db2c2eb71 libiproute: print_route() always uses stdout, do not pass FILE pointer to it.
libiproute: Use FAST_FUNC

function                                             old     new   delta
iprule_modify                                        884     905     +21
ipaddr_modify                                       1289    1310     +21
rtnl_send                                             53      69     +16
xrtnl_wilddump_request                               109     124     +15
xrtnl_dump_filter                                    394     403      +9
rtnl_talk                                            534     539      +5
print_addrinfo                                      1369    1374      +5
iproute_modify                                      1017    1020      +3
iprule_list                                           81      83      +2
xrtnl_open                                           163     161      -2
parse_rtattr                                          89      87      -2
ipaddr_list_or_flush                                2176    2174      -2
addattr_l                                             91      88      -3
flush_update                                         116     108      -8
iproute_list_or_flush                               1285    1263     -22
iproute_get                                          878     852     -26
print_route                                         1913    1752    -161
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 9/8 up/down: 97/-226)          Total: -129 bytes
2008-06-29 06:22:40 +00:00
Denis Vlasenko
7049ff8696 whitespace fixes. no code changes 2008-06-25 09:53:17 +00:00
Bernhard Reutner-Fischer
9de4622055 - make the first arg of the filter function passed to rtnl_dump_filter constant
to match normal iproute. No obj-code changes.
2008-06-12 15:54:49 +00:00
Denis Vlasenko
52a8d975da ip: make numeric table work: "ip route list table 255". closes bug 3664.
function                                             old     new   delta
iproute_list_or_flush                               1270    1300     +30
2008-06-08 00:25:55 +00:00
Denis Vlasenko
53354ac47d libbb: introduce and use print_flags().
Mostly by Natanael Copa <natanael.copa AT gmail.com>

function                                             old     new   delta
print_e2flags                                          -     189    +189
print_flags_separated                                  -      86     +86
static.flag_labels                                     -      60     +60
static.dma_wmode_masks                                 -      32     +32
static.flag_masks                                      -      28     +28
static.arp_labels                                      -      16     +16
static.arp_masks                                       -      12     +12
ls_main                                              836     843      +7
...
popstring                                            140     134      -6
arp_show                                             740     708     -32
print_flags                                          189      25    -164
ipaddr_list_or_flush                                2396    2170    -226
process_dev                                         5306    4706    -600
------------------------------------------------------------------------------
(add/remove: 10/0 grow/shrink: 5/10 up/down: 458/-1043)      Total: -585 bytes
   text    data     bss     dec     hex filename
 810564     624    7060  818248   c7c48 busybox_old
 810002     624    7060  817686   c7a16 busybox_unstripped
2008-06-07 15:10:29 +00:00
Denis Vlasenko
9b6f4aa8e8 ip: support for the LOWER_UP flag by Natanael Copa <natanael.copa@gmail.com>.
~50 bytes code growth.
2008-06-05 14:01:04 +00:00
Denis Vlasenko
7d60fc1c0a replace single-char printf's with bb_putchar 2008-06-05 06:51:06 +00:00
Denis Vlasenko
bedfabd500 libiproute: use stdout directly instead of passing it as a parameter
function                                             old     new   delta
iprule_list                                           86      82      -4
print_rule                                           860     791     -69
ipaddr_list_or_flush                                2484    2384    -100
print_addrinfo                                      1498    1292    -206
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-379)           Total: -379 bytes
2008-06-05 05:00:24 +00:00
Denis Vlasenko
d12fcc20da libiproute: fix option parsing, so that "ip -o link" works again.
closes bug 3524
2008-05-31 07:34:14 +00:00
Denis Vlasenko
3e57adb731 libiproute: style fixes, and using smallint as appropriate
function                                             old     new   delta
print_route                                         1730    1731      +1
print_addrinfo                                      1497    1498      +1
iproute_list_or_flush                               1232    1229      -3
ipaddr_list_or_flush                                2490    2484      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 2/-9)               Total: -7 bytes
2008-05-31 07:33:18 +00:00
Bernhard Reutner-Fischer
636a1f85e8 - use EXIT_{SUCCESS,FAILURE}. No object-code changes 2008-05-19 09:29:47 +00:00
Bernhard Reutner-Fischer
51a06c07da - accept ip l s ib0 addr 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 2008-05-16 17:19:03 +00:00
Bernhard Reutner-Fischer
b8635e28b5 - very minor shrinkage
odd that this saved 1byte. And there could be something wrong with
  ifcombine or the like since omitting the braces produces bigger code?
2008-05-16 16:55:17 +00:00