klibc-bot for Herbert Xu
2020-Mar-28 21:48 UTC
[klibc] [klibc:update-dash] dash: [INPUT] Kill pgetc_macro
Commit-ID: d23eb0c786db8c7816a30978609ce6351e3b8583 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d23eb0c786db8c7816a30978609ce6351e3b8583 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Mon, 29 Sep 2014 17:05:53 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: [INPUT] Kill pgetc_macro [ dash commit 339b9c0781cca7afb0964c6a655cda8ad9cf9fc2 ] pgetc_macro is identical to pgetc except that it's a macro and pgetc isn't. Since there is very little performance difference on modern systems it's time to kill pgetc_macro. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/input.c | 7 +++++-- usr/dash/input.h | 3 --- usr/dash/parser.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/usr/dash/input.c b/usr/dash/input.c index d31c45bb..9e533a47 100644 --- a/usr/dash/input.c +++ b/usr/dash/input.c @@ -134,7 +134,10 @@ RESET { int pgetc(void) { - return pgetc_macro(); + if (--parsenleft >= 0) + return (signed char)*parsenextc++; + else + return preadbuffer(); } @@ -147,7 +150,7 @@ pgetc2() { int c; do { - c = pgetc_macro(); + c = pgetc(); } while (c == PEOA); return c; } diff --git a/usr/dash/input.h b/usr/dash/input.h index 50a77971..775291b8 100644 --- a/usr/dash/input.h +++ b/usr/dash/input.h @@ -61,6 +61,3 @@ void setinputstring(char *); void popfile(void); void popallfiles(void); void closescript(void); - -#define pgetc_macro() \ - (--parsenleft >= 0 ? (signed char)*parsenextc++ : preadbuffer()) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 572cbcd5..c4eaae2b 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -775,7 +775,7 @@ xxreadtoken(void) setprompt(2); } for (;;) { /* until token or start of word found */ - c = pgetc_macro(); + c = pgetc(); switch (c) { case ' ': case '\t': case PEOA: @@ -1009,7 +1009,7 @@ quotemark: USTPUTC(c, out); } } - c = pgetc_macro(); + c = pgetc(); } } endword:
Maybe Matching Threads
- [klibc:update-dash] [INPUT] Kill pgetc_macro
- [klibc:update-dash] input: Move all input state into parsefile
- [klibc:update-dash] dash: input: Move all input state into parsefile
- [klibc:update-dash] input: Allow two consecutive calls to pungetc
- [klibc:update-dash] dash: input: Allow two consecutive calls to pungetc