summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 17:30:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 17:30:03 +0200
commit46e92e1e568021ecdfa30bfea0efabe72b85633b (patch)
treeeec82b604bfc0c2ec6784f83a54e5447beeb4082
parenta33d19eba8c614d113378ed07bbec0ce06227028 (diff)
downloadbusybox-46e92e1e568021ecdfa30bfea0efabe72b85633b.tar.gz
ash: code shrink: do not take address of prefix(), allowing it to inline
function old new delta getjob 281 285 +4 prefix 13 - -13 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 4/-13) Total: -9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c
index cb674e69c..d4ee4c93e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -3962,7 +3962,6 @@ getjob(const char *name, int getctl)
unsigned num;
int c;
const char *p;
- char *(*match)(const char *, const char *);
jp = curjob;
p = name;
@@ -4003,15 +4002,12 @@ getjob(const char *name, int getctl)
}
}
- match = prefix;
- if (*p == '?') {
- match = strstr;
- p++;
- }
-
found = NULL;
while (jp) {
- if (match(jp->ps[0].ps_cmd, p)) {
+ if (*p == '?'
+ ? strstr(jp->ps[0].ps_cmd, p + 1)
+ : prefix(jp->ps[0].ps_cmd, p)
+ ) {
if (found)
goto err;
found = jp;