diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-05 12:06:05 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-05 12:06:05 +0200 |
commit | d5f1b1bbe0a881f66b6bb6951fa54e553002c24d (patch) | |
tree | a3da20d19fa86c77e63c08f01d052b196cb1b192 /shell/hush.c | |
parent | 8507e1f10927bc6498cf38eb8324a53bde8e0a61 (diff) | |
download | busybox-w32-d5f1b1bbe0a881f66b6bb6951fa54e553002c24d.tar.gz busybox-w32-d5f1b1bbe0a881f66b6bb6951fa54e553002c24d.tar.bz2 busybox-w32-d5f1b1bbe0a881f66b6bb6951fa54e553002c24d.zip |
*: 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>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/shell/hush.c b/shell/hush.c index a6db16c35..f34fdd402 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -256,8 +256,8 @@ typedef struct in_str { | |||
256 | smallint promptmode; /* 0: PS1, 1: PS2 */ | 256 | smallint promptmode; /* 0: PS1, 1: PS2 */ |
257 | #endif | 257 | #endif |
258 | FILE *file; | 258 | FILE *file; |
259 | int (*get) (struct in_str *); | 259 | int (*get) (struct in_str *) FAST_FUNC; |
260 | int (*peek) (struct in_str *); | 260 | int (*peek) (struct in_str *) FAST_FUNC; |
261 | } in_str; | 261 | } in_str; |
262 | #define i_getch(input) ((input)->get(input)) | 262 | #define i_getch(input) ((input)->get(input)) |
263 | #define i_peek(input) ((input)->peek(input)) | 263 | #define i_peek(input) ((input)->peek(input)) |
@@ -537,43 +537,43 @@ struct globals { | |||
537 | 537 | ||
538 | 538 | ||
539 | /* Function prototypes for builtins */ | 539 | /* Function prototypes for builtins */ |
540 | static int builtin_cd(char **argv); | 540 | static int builtin_cd(char **argv) FAST_FUNC; |
541 | static int builtin_echo(char **argv); | 541 | static int builtin_echo(char **argv) FAST_FUNC; |
542 | static int builtin_eval(char **argv); | 542 | static int builtin_eval(char **argv) FAST_FUNC; |
543 | static int builtin_exec(char **argv); | 543 | static int builtin_exec(char **argv) FAST_FUNC; |
544 | static int builtin_exit(char **argv); | 544 | static int builtin_exit(char **argv) FAST_FUNC; |
545 | static int builtin_export(char **argv); | 545 | static int builtin_export(char **argv) FAST_FUNC; |
546 | #if ENABLE_HUSH_JOB | 546 | #if ENABLE_HUSH_JOB |
547 | static int builtin_fg_bg(char **argv); | 547 | static int builtin_fg_bg(char **argv) FAST_FUNC; |
548 | static int builtin_jobs(char **argv); | 548 | static int builtin_jobs(char **argv) FAST_FUNC; |
549 | #endif | 549 | #endif |
550 | #if ENABLE_HUSH_HELP | 550 | #if ENABLE_HUSH_HELP |
551 | static int builtin_help(char **argv); | 551 | static int builtin_help(char **argv) FAST_FUNC; |
552 | #endif | 552 | #endif |
553 | #if ENABLE_HUSH_LOCAL | 553 | #if ENABLE_HUSH_LOCAL |
554 | static int builtin_local(char **argv); | 554 | static int builtin_local(char **argv) FAST_FUNC; |
555 | #endif | 555 | #endif |
556 | #if HUSH_DEBUG | 556 | #if HUSH_DEBUG |
557 | static int builtin_memleak(char **argv); | 557 | static int builtin_memleak(char **argv) FAST_FUNC; |
558 | #endif | 558 | #endif |
559 | static int builtin_pwd(char **argv); | 559 | static int builtin_pwd(char **argv) FAST_FUNC; |
560 | static int builtin_read(char **argv); | 560 | static int builtin_read(char **argv) FAST_FUNC; |
561 | static int builtin_set(char **argv); | 561 | static int builtin_set(char **argv) FAST_FUNC; |
562 | static int builtin_shift(char **argv); | 562 | static int builtin_shift(char **argv) FAST_FUNC; |
563 | static int builtin_source(char **argv); | 563 | static int builtin_source(char **argv) FAST_FUNC; |
564 | static int builtin_test(char **argv); | 564 | static int builtin_test(char **argv) FAST_FUNC; |
565 | static int builtin_trap(char **argv); | 565 | static int builtin_trap(char **argv) FAST_FUNC; |
566 | static int builtin_type(char **argv); | 566 | static int builtin_type(char **argv) FAST_FUNC; |
567 | static int builtin_true(char **argv); | 567 | static int builtin_true(char **argv) FAST_FUNC; |
568 | static int builtin_umask(char **argv); | 568 | static int builtin_umask(char **argv) FAST_FUNC; |
569 | static int builtin_unset(char **argv); | 569 | static int builtin_unset(char **argv) FAST_FUNC; |
570 | static int builtin_wait(char **argv); | 570 | static int builtin_wait(char **argv) FAST_FUNC; |
571 | #if ENABLE_HUSH_LOOPS | 571 | #if ENABLE_HUSH_LOOPS |
572 | static int builtin_break(char **argv); | 572 | static int builtin_break(char **argv) FAST_FUNC; |
573 | static int builtin_continue(char **argv); | 573 | static int builtin_continue(char **argv) FAST_FUNC; |
574 | #endif | 574 | #endif |
575 | #if ENABLE_HUSH_FUNCTIONS | 575 | #if ENABLE_HUSH_FUNCTIONS |
576 | static int builtin_return(char **argv); | 576 | static int builtin_return(char **argv) FAST_FUNC; |
577 | #endif | 577 | #endif |
578 | 578 | ||
579 | /* Table of built-in functions. They can be forked or not, depending on | 579 | /* Table of built-in functions. They can be forked or not, depending on |
@@ -584,7 +584,7 @@ static int builtin_return(char **argv); | |||
584 | * still be set at the end. */ | 584 | * still be set at the end. */ |
585 | struct built_in_command { | 585 | struct built_in_command { |
586 | const char *cmd; | 586 | const char *cmd; |
587 | int (*function)(char **argv); | 587 | int (*function)(char **argv) FAST_FUNC; |
588 | #if ENABLE_HUSH_HELP | 588 | #if ENABLE_HUSH_HELP |
589 | const char *descr; | 589 | const char *descr; |
590 | # define BLTIN(cmd, func, help) { cmd, func, help } | 590 | # define BLTIN(cmd, func, help) { cmd, func, help } |
@@ -1541,7 +1541,7 @@ static struct variable *set_vars_and_save_old(char **strings) | |||
1541 | /* | 1541 | /* |
1542 | * in_str support | 1542 | * in_str support |
1543 | */ | 1543 | */ |
1544 | static int static_get(struct in_str *i) | 1544 | static int FAST_FUNC static_get(struct in_str *i) |
1545 | { | 1545 | { |
1546 | int ch = *i->p++; | 1546 | int ch = *i->p++; |
1547 | if (ch != '\0') | 1547 | if (ch != '\0') |
@@ -1550,7 +1550,7 @@ static int static_get(struct in_str *i) | |||
1550 | return EOF; | 1550 | return EOF; |
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | static int static_peek(struct in_str *i) | 1553 | static int FAST_FUNC static_peek(struct in_str *i) |
1554 | { | 1554 | { |
1555 | return *i->p; | 1555 | return *i->p; |
1556 | } | 1556 | } |
@@ -1629,7 +1629,7 @@ static void get_user_input(struct in_str *i) | |||
1629 | 1629 | ||
1630 | /* This is the magic location that prints prompts | 1630 | /* This is the magic location that prints prompts |
1631 | * and gets data back from the user */ | 1631 | * and gets data back from the user */ |
1632 | static int file_get(struct in_str *i) | 1632 | static int FAST_FUNC file_get(struct in_str *i) |
1633 | { | 1633 | { |
1634 | int ch; | 1634 | int ch; |
1635 | 1635 | ||
@@ -1668,7 +1668,7 @@ static int file_get(struct in_str *i) | |||
1668 | /* All callers guarantee this routine will never | 1668 | /* All callers guarantee this routine will never |
1669 | * be used right after a newline, so prompting is not needed. | 1669 | * be used right after a newline, so prompting is not needed. |
1670 | */ | 1670 | */ |
1671 | static int file_peek(struct in_str *i) | 1671 | static int FAST_FUNC file_peek(struct in_str *i) |
1672 | { | 1672 | { |
1673 | int ch; | 1673 | int ch; |
1674 | if (i->p && *i->p) { | 1674 | if (i->p && *i->p) { |
@@ -6560,12 +6560,12 @@ int lash_main(int argc, char **argv) | |||
6560 | /* | 6560 | /* |
6561 | * Built-ins | 6561 | * Built-ins |
6562 | */ | 6562 | */ |
6563 | static int builtin_true(char **argv UNUSED_PARAM) | 6563 | static int FAST_FUNC builtin_true(char **argv UNUSED_PARAM) |
6564 | { | 6564 | { |
6565 | return 0; | 6565 | return 0; |
6566 | } | 6566 | } |
6567 | 6567 | ||
6568 | static int builtin_test(char **argv) | 6568 | static int FAST_FUNC builtin_test(char **argv) |
6569 | { | 6569 | { |
6570 | int argc = 0; | 6570 | int argc = 0; |
6571 | while (*argv) { | 6571 | while (*argv) { |
@@ -6575,7 +6575,7 @@ static int builtin_test(char **argv) | |||
6575 | return test_main(argc, argv - argc); | 6575 | return test_main(argc, argv - argc); |
6576 | } | 6576 | } |
6577 | 6577 | ||
6578 | static int builtin_echo(char **argv) | 6578 | static int FAST_FUNC builtin_echo(char **argv) |
6579 | { | 6579 | { |
6580 | int argc = 0; | 6580 | int argc = 0; |
6581 | while (*argv) { | 6581 | while (*argv) { |
@@ -6585,7 +6585,7 @@ static int builtin_echo(char **argv) | |||
6585 | return echo_main(argc, argv - argc); | 6585 | return echo_main(argc, argv - argc); |
6586 | } | 6586 | } |
6587 | 6587 | ||
6588 | static int builtin_eval(char **argv) | 6588 | static int FAST_FUNC builtin_eval(char **argv) |
6589 | { | 6589 | { |
6590 | int rcode = EXIT_SUCCESS; | 6590 | int rcode = EXIT_SUCCESS; |
6591 | 6591 | ||
@@ -6602,7 +6602,7 @@ static int builtin_eval(char **argv) | |||
6602 | return rcode; | 6602 | return rcode; |
6603 | } | 6603 | } |
6604 | 6604 | ||
6605 | static int builtin_cd(char **argv) | 6605 | static int FAST_FUNC builtin_cd(char **argv) |
6606 | { | 6606 | { |
6607 | const char *newdir = argv[1]; | 6607 | const char *newdir = argv[1]; |
6608 | if (newdir == NULL) { | 6608 | if (newdir == NULL) { |
@@ -6621,7 +6621,7 @@ static int builtin_cd(char **argv) | |||
6621 | return EXIT_SUCCESS; | 6621 | return EXIT_SUCCESS; |
6622 | } | 6622 | } |
6623 | 6623 | ||
6624 | static int builtin_exec(char **argv) | 6624 | static int FAST_FUNC builtin_exec(char **argv) |
6625 | { | 6625 | { |
6626 | if (*++argv == NULL) | 6626 | if (*++argv == NULL) |
6627 | return EXIT_SUCCESS; /* bash does this */ | 6627 | return EXIT_SUCCESS; /* bash does this */ |
@@ -6635,7 +6635,7 @@ static int builtin_exec(char **argv) | |||
6635 | } | 6635 | } |
6636 | } | 6636 | } |
6637 | 6637 | ||
6638 | static int builtin_exit(char **argv) | 6638 | static int FAST_FUNC builtin_exit(char **argv) |
6639 | { | 6639 | { |
6640 | debug_printf_exec("%s()\n", __func__); | 6640 | debug_printf_exec("%s()\n", __func__); |
6641 | 6641 | ||
@@ -6730,7 +6730,7 @@ static void helper_export_local(char **argv, int exp, int lvl) | |||
6730 | } while (*++argv); | 6730 | } while (*++argv); |
6731 | } | 6731 | } |
6732 | 6732 | ||
6733 | static int builtin_export(char **argv) | 6733 | static int FAST_FUNC builtin_export(char **argv) |
6734 | { | 6734 | { |
6735 | unsigned opt_unexport; | 6735 | unsigned opt_unexport; |
6736 | 6736 | ||
@@ -6778,7 +6778,7 @@ static int builtin_export(char **argv) | |||
6778 | } | 6778 | } |
6779 | 6779 | ||
6780 | #if ENABLE_HUSH_LOCAL | 6780 | #if ENABLE_HUSH_LOCAL |
6781 | static int builtin_local(char **argv) | 6781 | static int FAST_FUNC builtin_local(char **argv) |
6782 | { | 6782 | { |
6783 | if (G.func_nest_level == 0) { | 6783 | if (G.func_nest_level == 0) { |
6784 | bb_error_msg("%s: not in a function", argv[0]); | 6784 | bb_error_msg("%s: not in a function", argv[0]); |
@@ -6789,7 +6789,7 @@ static int builtin_local(char **argv) | |||
6789 | } | 6789 | } |
6790 | #endif | 6790 | #endif |
6791 | 6791 | ||
6792 | static int builtin_trap(char **argv) | 6792 | static int FAST_FUNC builtin_trap(char **argv) |
6793 | { | 6793 | { |
6794 | int sig; | 6794 | int sig; |
6795 | char *new_cmd; | 6795 | char *new_cmd; |
@@ -6879,7 +6879,7 @@ static int builtin_trap(char **argv) | |||
6879 | } | 6879 | } |
6880 | 6880 | ||
6881 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/type.html */ | 6881 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/type.html */ |
6882 | static int builtin_type(char **argv) | 6882 | static int FAST_FUNC builtin_type(char **argv) |
6883 | { | 6883 | { |
6884 | int ret = EXIT_SUCCESS; | 6884 | int ret = EXIT_SUCCESS; |
6885 | 6885 | ||
@@ -6913,7 +6913,7 @@ static int builtin_type(char **argv) | |||
6913 | 6913 | ||
6914 | #if ENABLE_HUSH_JOB | 6914 | #if ENABLE_HUSH_JOB |
6915 | /* built-in 'fg' and 'bg' handler */ | 6915 | /* built-in 'fg' and 'bg' handler */ |
6916 | static int builtin_fg_bg(char **argv) | 6916 | static int FAST_FUNC builtin_fg_bg(char **argv) |
6917 | { | 6917 | { |
6918 | int i, jobnum; | 6918 | int i, jobnum; |
6919 | struct pipe *pi; | 6919 | struct pipe *pi; |
@@ -6976,7 +6976,7 @@ static int builtin_fg_bg(char **argv) | |||
6976 | #endif | 6976 | #endif |
6977 | 6977 | ||
6978 | #if ENABLE_HUSH_HELP | 6978 | #if ENABLE_HUSH_HELP |
6979 | static int builtin_help(char **argv UNUSED_PARAM) | 6979 | static int FAST_FUNC builtin_help(char **argv UNUSED_PARAM) |
6980 | { | 6980 | { |
6981 | const struct built_in_command *x; | 6981 | const struct built_in_command *x; |
6982 | 6982 | ||
@@ -6992,7 +6992,7 @@ static int builtin_help(char **argv UNUSED_PARAM) | |||
6992 | #endif | 6992 | #endif |
6993 | 6993 | ||
6994 | #if ENABLE_HUSH_JOB | 6994 | #if ENABLE_HUSH_JOB |
6995 | static int builtin_jobs(char **argv UNUSED_PARAM) | 6995 | static int FAST_FUNC builtin_jobs(char **argv UNUSED_PARAM) |
6996 | { | 6996 | { |
6997 | struct pipe *job; | 6997 | struct pipe *job; |
6998 | const char *status_string; | 6998 | const char *status_string; |
@@ -7010,7 +7010,7 @@ static int builtin_jobs(char **argv UNUSED_PARAM) | |||
7010 | #endif | 7010 | #endif |
7011 | 7011 | ||
7012 | #if HUSH_DEBUG | 7012 | #if HUSH_DEBUG |
7013 | static int builtin_memleak(char **argv UNUSED_PARAM) | 7013 | static int FAST_FUNC builtin_memleak(char **argv UNUSED_PARAM) |
7014 | { | 7014 | { |
7015 | void *p; | 7015 | void *p; |
7016 | unsigned long l; | 7016 | unsigned long l; |
@@ -7039,13 +7039,13 @@ static int builtin_memleak(char **argv UNUSED_PARAM) | |||
7039 | } | 7039 | } |
7040 | #endif | 7040 | #endif |
7041 | 7041 | ||
7042 | static int builtin_pwd(char **argv UNUSED_PARAM) | 7042 | static int FAST_FUNC builtin_pwd(char **argv UNUSED_PARAM) |
7043 | { | 7043 | { |
7044 | puts(set_cwd()); | 7044 | puts(set_cwd()); |
7045 | return EXIT_SUCCESS; | 7045 | return EXIT_SUCCESS; |
7046 | } | 7046 | } |
7047 | 7047 | ||
7048 | static int builtin_read(char **argv) | 7048 | static int FAST_FUNC builtin_read(char **argv) |
7049 | { | 7049 | { |
7050 | char *string; | 7050 | char *string; |
7051 | const char *name = "REPLY"; | 7051 | const char *name = "REPLY"; |
@@ -7088,7 +7088,7 @@ static int builtin_read(char **argv) | |||
7088 | * | 7088 | * |
7089 | * So far, we only support "set -- [argument...]" and some of the short names. | 7089 | * So far, we only support "set -- [argument...]" and some of the short names. |
7090 | */ | 7090 | */ |
7091 | static int builtin_set(char **argv) | 7091 | static int FAST_FUNC builtin_set(char **argv) |
7092 | { | 7092 | { |
7093 | int n; | 7093 | int n; |
7094 | char **pp, **g_argv; | 7094 | char **pp, **g_argv; |
@@ -7147,7 +7147,7 @@ static int builtin_set(char **argv) | |||
7147 | return EXIT_FAILURE; | 7147 | return EXIT_FAILURE; |
7148 | } | 7148 | } |
7149 | 7149 | ||
7150 | static int builtin_shift(char **argv) | 7150 | static int FAST_FUNC builtin_shift(char **argv) |
7151 | { | 7151 | { |
7152 | int n = 1; | 7152 | int n = 1; |
7153 | if (argv[1]) { | 7153 | if (argv[1]) { |
@@ -7167,7 +7167,7 @@ static int builtin_shift(char **argv) | |||
7167 | return EXIT_FAILURE; | 7167 | return EXIT_FAILURE; |
7168 | } | 7168 | } |
7169 | 7169 | ||
7170 | static int builtin_source(char **argv) | 7170 | static int FAST_FUNC builtin_source(char **argv) |
7171 | { | 7171 | { |
7172 | char *arg_path; | 7172 | char *arg_path; |
7173 | FILE *input; | 7173 | FILE *input; |
@@ -7208,7 +7208,7 @@ static int builtin_source(char **argv) | |||
7208 | return G.last_exitcode; | 7208 | return G.last_exitcode; |
7209 | } | 7209 | } |
7210 | 7210 | ||
7211 | static int builtin_umask(char **argv) | 7211 | static int FAST_FUNC builtin_umask(char **argv) |
7212 | { | 7212 | { |
7213 | int rc; | 7213 | int rc; |
7214 | mode_t mask; | 7214 | mode_t mask; |
@@ -7240,7 +7240,7 @@ static int builtin_umask(char **argv) | |||
7240 | } | 7240 | } |
7241 | 7241 | ||
7242 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#unset */ | 7242 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#unset */ |
7243 | static int builtin_unset(char **argv) | 7243 | static int FAST_FUNC builtin_unset(char **argv) |
7244 | { | 7244 | { |
7245 | int ret; | 7245 | int ret; |
7246 | unsigned opts; | 7246 | unsigned opts; |
@@ -7277,7 +7277,7 @@ static int builtin_unset(char **argv) | |||
7277 | } | 7277 | } |
7278 | 7278 | ||
7279 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/wait.html */ | 7279 | /* http://www.opengroup.org/onlinepubs/9699919799/utilities/wait.html */ |
7280 | static int builtin_wait(char **argv) | 7280 | static int FAST_FUNC builtin_wait(char **argv) |
7281 | { | 7281 | { |
7282 | int ret = EXIT_SUCCESS; | 7282 | int ret = EXIT_SUCCESS; |
7283 | int status, sig; | 7283 | int status, sig; |
@@ -7361,7 +7361,7 @@ static unsigned parse_numeric_argv1(char **argv, unsigned def, unsigned def_min) | |||
7361 | #endif | 7361 | #endif |
7362 | 7362 | ||
7363 | #if ENABLE_HUSH_LOOPS | 7363 | #if ENABLE_HUSH_LOOPS |
7364 | static int builtin_break(char **argv) | 7364 | static int FAST_FUNC builtin_break(char **argv) |
7365 | { | 7365 | { |
7366 | unsigned depth; | 7366 | unsigned depth; |
7367 | if (G.depth_of_loop == 0) { | 7367 | if (G.depth_of_loop == 0) { |
@@ -7379,7 +7379,7 @@ static int builtin_break(char **argv) | |||
7379 | return EXIT_SUCCESS; | 7379 | return EXIT_SUCCESS; |
7380 | } | 7380 | } |
7381 | 7381 | ||
7382 | static int builtin_continue(char **argv) | 7382 | static int FAST_FUNC builtin_continue(char **argv) |
7383 | { | 7383 | { |
7384 | G.flag_break_continue = 1; /* BC_CONTINUE = 2 = 1+1 */ | 7384 | G.flag_break_continue = 1; /* BC_CONTINUE = 2 = 1+1 */ |
7385 | return builtin_break(argv); | 7385 | return builtin_break(argv); |
@@ -7387,7 +7387,7 @@ static int builtin_continue(char **argv) | |||
7387 | #endif | 7387 | #endif |
7388 | 7388 | ||
7389 | #if ENABLE_HUSH_FUNCTIONS | 7389 | #if ENABLE_HUSH_FUNCTIONS |
7390 | static int builtin_return(char **argv) | 7390 | static int FAST_FUNC builtin_return(char **argv) |
7391 | { | 7391 | { |
7392 | int rc; | 7392 | int rc; |
7393 | 7393 | ||