aboutsummaryrefslogtreecommitdiff
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-w32-a33d19eba8c614d113378ed07bbec0ce06227028.tar.gz
busybox-w32-a33d19eba8c614d113378ed07bbec0ce06227028.tar.bz2
busybox-w32-a33d19eba8c614d113378ed07bbec0ce06227028.zip
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)
1852/* 1852/*
1853 * prefix -- see if pfx is a prefix of string. 1853 * prefix -- see if pfx is a prefix of string.
1854 */ 1854 */
1855static char * 1855static ALWAYS_INLINE char *
1856prefix(const char *string, const char *pfx) 1856prefix(const char *string, const char *pfx)
1857{ 1857{
1858 return is_prefixed_with(string, pfx);
1859#if 0 /* dash implementation: */
1858 while (*pfx) { 1860 while (*pfx) {
1859 if (*pfx++ != *string++) 1861 if (*pfx++ != *string++)
1860 return NULL; 1862 return NULL;
1861 } 1863 }
1862 return (char *) string; 1864 return (char *) string;
1865#endif
1863} 1866}
1864
1865/* 1867/*
1866 * Check for a valid number. This should be elsewhere. 1868 * Check for a valid number. This should be elsewhere.
1867 */ 1869 */