summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sbi/sbi_string.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/sbi/sbi_string.c b/lib/sbi/sbi_string.c
index f4f13942..3a10c254 100644
--- a/lib/sbi/sbi_string.c
+++ b/lib/sbi/sbi_string.c
@@ -88,13 +88,12 @@ char *sbi_strncpy(char *dest, const char *src, size_t count)
char *sbi_strchr(const char *s, int c)
{
- while (*s != '\0' && *s != (char)c)
- s++;
+ do {
+ if (*s == (char)c)
+ return (char *)s;
+ } while (*s++ != '\0');
- if (*s == '\0')
- return NULL;
- else
- return (char *)s;
+ return NULL;
}
char *sbi_strrchr(const char *s, int c)