1
0
forked from drath/libratbag

shared-macro: make startswith() return a const char*

The supplied arguments are const, and as such the return type which is
derived from the arguments must also be const.
This commit is contained in:
Yaroslav Chvanov
2023-03-19 02:02:09 +03:00
parent 876c06237e
commit 44279ddda3

View File

@@ -235,13 +235,13 @@ static inline bool streq_ptr(const char *a, const char *b)
* This returns a pointer to the first character in @s that follows @prefix. If
* @s does not start with @prefix, NULL is returned.
*/
static inline char *startswith(const char *s, const char *prefix)
static inline const char *startswith(const char *s, const char *prefix)
{
size_t l;
l = strlen(prefix);
if (strncmp(s, prefix, l) == 0)
return (char*) s + l;
return s + l;
return NULL;
}