aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-10-12 18:05:51 -0500
committerRob Landley <rob@landley.net>2019-10-12 18:05:51 -0500
commit0424fdaa6db8f4dbdd1cdbe0f700dd92787e157b (patch)
tree2f4995b1e9ccf8525c03864a2c93b57236eb0340 /lib
parentf69ca9e9d29c9dfde2860f7d60d57fdbfde856a0 (diff)
downloadtoybox-0424fdaa6db8f4dbdd1cdbe0f700dd92787e157b.tar.gz
Sigh, second attempt at removing strlen() from strstart().
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index dafd514a..fe402af8 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -449,9 +449,10 @@ int strstart(char **a, char *b)
{
char *c = *a;
- if (*b) while (*b++ == *c++) if (!*b) return c-*a;
+ while (*b && *c == *b) b++, c++;
+ if (!*b) *a = c;
- return 0;
+ return !*b;
}
// If *a starts with b, advance *a past it and return 1, else return 0;