From 0424fdaa6db8f4dbdd1cdbe0f700dd92787e157b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 12 Oct 2019 18:05:51 -0500 Subject: Sigh, second attempt at removing strlen() from strstart(). --- lib/lib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') 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; -- cgit v1.2.3