← Commit list

e05b922c8

Denys Vlasenko
Denys Vlasenko
2026-01-27
SUCCESS Duration: 144s

Subject

ash: move casematch() directly to its only caller, no code changes

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
gcc -Wp,-MD,applets/.usage.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer      -Iinclude -Iinclude -o applets/usage applets/usage.c

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+36 -31
@@ -8433,37 +8433,6 @@ expandhere(union node *arg)
expandarg(arg, (struct arglist *)NULL, EXP_QUOTED);
}
-/*
- * Returns true if the pattern matches the string.
- */
-static int
-patmatch(char *pattern, const char *string)
-{
- char *p = preglob(pattern, 0);
- int r = pmatch(p, string);
- //bb_error_msg("!fnmatch(pattern:'%s',str:'%s',0):%d", p, string, r);
- return r;
-}
-
-/*
- * See if a pattern matches in a case statement.
- */
-static int
-casematch(union node *pattern, char *val)
-{
- struct stackmark smark;
- int result;
-
- setstackmark(&smark);
- argbackq = pattern->narg.backquote;
- STARTSTACKSTR(expdest);
- argstr(pattern->narg.text, EXP_TILDE | EXP_CASE);
- ifsfree();
- result = patmatch(stackblock(), val);
- popstackmark(&smark);
- return result;
-}
-
/* ============ find_command */
@@ -8755,6 +8724,11 @@ changepath(const char *newval)
builtinloc = bltin;
clearcmdentry();
}
+
+
+/*
+ * Parsing.
+ */
enum {
TEOF,
TNL,
@@ -9699,6 +9673,37 @@ evalfor(union node *n, int flags)
return status;
}
+/*
+ * Returns true if the pattern matches the string.
+ */
+static int
+patmatch(char *pattern, const char *string)
+{
+ char *p = preglob(pattern, 0);
+ int r = pmatch(p, string);
+ //bb_error_msg("!fnmatch(pattern:'%s',str:'%s',0):%d", p, string, r);
+ return r;
+}
+
+/*
+ * See if a pattern matches in a case statement.
+ */
+static int
+casematch(union node *pattern, char *val)
+{
+ struct stackmark smark;
+ int result;
+
+ setstackmark(&smark);
+ argbackq = pattern->narg.backquote;
+ STARTSTACKSTR(expdest);
+ argstr(pattern->narg.text, EXP_TILDE | EXP_CASE);
+ ifsfree();
+ result = patmatch(stackblock(), val);
+ popstackmark(&smark);
+ return result;
+}
+
static int
evalcase(union node *n, int flags)
{