diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-11 12:44:25 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-11 12:44:25 +0100 |
commit | b0a57abb79001b994115d2c96a7d9e1f2f511430 (patch) | |
tree | 81208522f04ddd011760c73f43889cb6cea52a27 | |
parent | 6ebdf7aa7bc2eac2b43601d5b9ec70af22e38af3 (diff) | |
download | busybox-w32-b0a57abb79001b994115d2c96a7d9e1f2f511430.tar.gz busybox-w32-b0a57abb79001b994115d2c96a7d9e1f2f511430.tar.bz2 busybox-w32-b0a57abb79001b994115d2c96a7d9e1f2f511430.zip |
awk: code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/awk.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/editors/awk.c b/editors/awk.c index 829d8a425..d7c114e05 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -658,10 +658,8 @@ static void hash_remove(xhash *hash, const char *name) | |||
658 | 658 | ||
659 | /* ------ some useful functions ------ */ | 659 | /* ------ some useful functions ------ */ |
660 | 660 | ||
661 | static void skip_spaces(char **s) | 661 | static char *skip_spaces(char *p) |
662 | { | 662 | { |
663 | char *p = *s; | ||
664 | |||
665 | while (1) { | 663 | while (1) { |
666 | if (*p == '\\' && p[1] == '\n') { | 664 | if (*p == '\\' && p[1] == '\n') { |
667 | p++; | 665 | p++; |
@@ -671,7 +669,7 @@ static void skip_spaces(char **s) | |||
671 | } | 669 | } |
672 | p++; | 670 | p++; |
673 | } | 671 | } |
674 | *s = p; | 672 | return p; |
675 | } | 673 | } |
676 | 674 | ||
677 | /* returns old *s, advances *s past word and terminating NUL */ | 675 | /* returns old *s, advances *s past word and terminating NUL */ |
@@ -822,7 +820,7 @@ static double getvar_i(var *v) | |||
822 | if (s && *s) { | 820 | if (s && *s) { |
823 | v->number = my_strtod(&s); | 821 | v->number = my_strtod(&s); |
824 | if (v->type & VF_USER) { | 822 | if (v->type & VF_USER) { |
825 | skip_spaces(&s); | 823 | s = skip_spaces(s); |
826 | if (*s != '\0') | 824 | if (*s != '\0') |
827 | v->type &= ~VF_USER; | 825 | v->type &= ~VF_USER; |
828 | } | 826 | } |
@@ -981,7 +979,7 @@ static uint32_t next_token(uint32_t expected) | |||
981 | } else { | 979 | } else { |
982 | p = g_pos; | 980 | p = g_pos; |
983 | readnext: | 981 | readnext: |
984 | skip_spaces(&p); | 982 | p = skip_spaces(p); |
985 | g_lineno = t_lineno; | 983 | g_lineno = t_lineno; |
986 | if (*p == '#') | 984 | if (*p == '#') |
987 | while (*p != '\n' && *p != '\0') | 985 | while (*p != '\n' && *p != '\0') |
@@ -1080,7 +1078,7 @@ static uint32_t next_token(uint32_t expected) | |||
1080 | tc = TC_VARIABLE; | 1078 | tc = TC_VARIABLE; |
1081 | /* also consume whitespace between functionname and bracket */ | 1079 | /* also consume whitespace between functionname and bracket */ |
1082 | if (!(expected & TC_VARIABLE) || (expected & TC_ARRAY)) | 1080 | if (!(expected & TC_VARIABLE) || (expected & TC_ARRAY)) |
1083 | skip_spaces(&p); | 1081 | p = skip_spaces(p); |
1084 | if (*p == '(') { | 1082 | if (*p == '(') { |
1085 | tc = TC_FUNCTION; | 1083 | tc = TC_FUNCTION; |
1086 | } else { | 1084 | } else { |