mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user