path-util: take char* const* for strv where appropriate
This commit is contained in:
+11
-4
@@ -217,8 +217,10 @@ int path_make_relative_parent(const char *from_child, const char *to, char **ret
|
||||
return path_make_relative(from, to, ret);
|
||||
}
|
||||
|
||||
char* path_startswith_strv(const char *p, char **set) {
|
||||
STRV_FOREACH(s, set) {
|
||||
char* path_startswith_strv(const char *p, char * const *strv) {
|
||||
assert(p);
|
||||
|
||||
STRV_FOREACH(s, strv) {
|
||||
char *t;
|
||||
|
||||
t = path_startswith(p, *s);
|
||||
@@ -1368,7 +1370,9 @@ bool empty_or_root(const char *path) {
|
||||
return path_equal(path, "/");
|
||||
}
|
||||
|
||||
bool path_strv_contains(char **l, const char *path) {
|
||||
bool path_strv_contains(char * const *l, const char *path) {
|
||||
assert(path);
|
||||
|
||||
STRV_FOREACH(i, l)
|
||||
if (path_equal(*i, path))
|
||||
return true;
|
||||
@@ -1376,7 +1380,9 @@ bool path_strv_contains(char **l, const char *path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool prefixed_path_strv_contains(char **l, const char *path) {
|
||||
bool prefixed_path_strv_contains(char * const *l, const char *path) {
|
||||
assert(path);
|
||||
|
||||
STRV_FOREACH(i, l) {
|
||||
const char *j = *i;
|
||||
|
||||
@@ -1384,6 +1390,7 @@ bool prefixed_path_strv_contains(char **l, const char *path) {
|
||||
j++;
|
||||
if (*j == '+')
|
||||
j++;
|
||||
|
||||
if (path_equal(j, path))
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user