diff options
author | Rob Landley <rob@landley.net> | 2019-10-12 18:05:51 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-10-12 18:05:51 -0500 |
commit | 0424fdaa6db8f4dbdd1cdbe0f700dd92787e157b (patch) | |
tree | 2f4995b1e9ccf8525c03864a2c93b57236eb0340 | |
parent | f69ca9e9d29c9dfde2860f7d60d57fdbfde856a0 (diff) | |
download | toybox-0424fdaa6db8f4dbdd1cdbe0f700dd92787e157b.tar.gz |
Sigh, second attempt at removing strlen() from strstart().
-rw-r--r-- | lib/lib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |