Skip to content

Commit

Permalink
string_utils: make starts_with return value more sensible
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed May 9, 2024
1 parent edf733e commit 11c8d01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ static inline char *skip_space_mut(char *src) {

static inline bool starts_with(const char *str, const char *needle, bool ignore_case) {
if (ignore_case) {
return strncasecmp(str, needle, strlen(needle));
return strncasecmp(str, needle, strlen(needle)) == 0;
}
return strncmp(str, needle, strlen(needle));
return strncmp(str, needle, strlen(needle)) == 0;
}

/// Similar to `asprintf`, but it reuses the allocated memory pointed to by `*strp`, and
Expand Down

0 comments on commit 11c8d01

Please sign in to comment.