From a33d19eba8c614d113378ed07bbec0ce06227028 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 3 Apr 2023 15:19:13 +0200 Subject: 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 --- shell/ash.c | 6 ++++-- 1 file 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. */ -- cgit v1.2.3-55-g6feb