mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
string-util: Add startswith_strv()
This is the function version of STARTSWITH_SET(). We also move STARTSWITH_SET() to string-util.h as it fits more there than in strv.h and reimplement it using startswith_strv().
This commit is contained in:
@@ -1283,3 +1283,15 @@ char *find_line_startswith(const char *haystack, const char *needle) {
|
||||
|
||||
return p + strlen(needle);
|
||||
}
|
||||
|
||||
char *startswith_strv(const char *string, char **strv) {
|
||||
char *found = NULL;
|
||||
|
||||
STRV_FOREACH(i, strv) {
|
||||
found = startswith(string, *i);
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user