From 49cc3cac30c504abdbd2c075928f5711da4066e8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 27 Jul 2021 17:53:55 +0200 Subject: hush: optimize ${var/pattern/repl} for trivial patterns function old new delta expand_one_var 2353 2507 +154 Signed-off-by: Denys Vlasenko --- shell/match.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'shell/match.c') diff --git a/shell/match.c b/shell/match.c index ee8abb2db..90f77546d 100644 --- a/shell/match.c +++ b/shell/match.c @@ -64,11 +64,10 @@ char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags } while (loc != end) { - char c; int r; - c = *loc; if (flags & SCAN_MATCH_LEFT_HALF) { + char c = *loc; *loc = '\0'; r = fnmatch(pattern, string, 0); //bb_error_msg("fnmatch('%s','%s',0):%d", pattern, string, r); -- cgit v1.2.3