summaryrefslogtreecommitdiff
path: root/shell/match.c
diff options
context:
space:
mode:
authorDenys Vlasenko2021-07-27 17:53:55 +0200
committerDenys Vlasenko2021-07-27 17:53:55 +0200
commit49cc3cac30c504abdbd2c075928f5711da4066e8 (patch)
tree83760d4340bd8a39225f76650d34372137de9ed7 /shell/match.c
parentc450437a4e631378cd6a2dc06a5923ce811a950d (diff)
downloadbusybox-49cc3cac30c504abdbd2c075928f5711da4066e8.zip
busybox-49cc3cac30c504abdbd2c075928f5711da4066e8.tar.gz
hush: optimize ${var/pattern/repl} for trivial patterns
function old new delta expand_one_var 2353 2507 +154 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/match.c')
-rw-r--r--shell/match.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/shell/match.c b/shell/match.c
index ee8abb2..90f7754 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);