summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 15:19:13 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 15:19:13 +0200
commita33d19eba8c614d113378ed07bbec0ce06227028 (patch)
treeebd81036c626025e4d458a452049f32f7365862d
parent94780e3e8e926e7e9f384c4b70310b3e7e79abce (diff)
downloadbusybox-a33d19eba8c614d113378ed07bbec0ce06227028.tar.gz
ash: code shrink - reuse is_prefixed_with() from libbb
function old new delta changepath 67 68 +1 legal_pathopt 70 66 -4 prefix 34 13 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-25) Total: -24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index bd3afc0c8..cb674e69c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -1852,16 +1852,18 @@ _STPUTC(int c, char *p)
/*
* prefix -- see if pfx is a prefix of string.
*/
-static char *
+static ALWAYS_INLINE char *
prefix(const char *string, const char *pfx)
{
+ return is_prefixed_with(string, pfx);
+#if 0 /* dash implementation: */
while (*pfx) {
if (*pfx++ != *string++)
return NULL;
}
return (char *) string;
+#endif
}
-
/*
* Check for a valid number. This should be elsewhere.
*/