tree-wide: replace FOREACH_POINTER with FOREACH_ARGUMENT

The latter is more generic and while being compatible with
the former.
This commit is contained in:
Mike Yuan
2024-01-24 21:29:11 +08:00
parent e9a46668c3
commit 2d70878162
11 changed files with 62 additions and 146 deletions
-6
View File
@@ -266,12 +266,6 @@ static inline int __coverity_check_and_return__(int condition) {
/* Pointers range from NULL to POINTER_MAX */
#define POINTER_MAX ((void*) UINTPTR_MAX)
/* Iterates through a specified list of pointers. Accepts NULL pointers, but uses POINTER_MAX as internal marker for EOL. */
#define FOREACH_POINTER(p, x, ...) \
for (typeof(p) *_l = (typeof(p)[]) { ({ p = x; }), ##__VA_ARGS__, POINTER_MAX }; \
p != (typeof(p)) POINTER_MAX; \
p = *(++_l))
#define _FOREACH_ARRAY(i, array, num, m, end) \
for (typeof(array[0]) *i = (array), *end = ({ \
typeof(num) m = (num); \
+8 -7
View File
@@ -446,14 +446,15 @@ bool fstype_needs_quota(const char *fstype) {
}
bool fstype_is_api_vfs(const char *fstype) {
const FilesystemSet *fs;
assert(fstype);
FOREACH_POINTER(fs,
filesystem_sets + FILESYSTEM_SET_BASIC_API,
filesystem_sets + FILESYSTEM_SET_AUXILIARY_API,
filesystem_sets + FILESYSTEM_SET_PRIVILEGED_API,
filesystem_sets + FILESYSTEM_SET_TEMPORARY)
if (nulstr_contains(fs->value, fstype))
const FilesystemSet *fs;
FOREACH_ARGUMENT(fs,
filesystem_sets + FILESYSTEM_SET_BASIC_API,
filesystem_sets + FILESYSTEM_SET_AUXILIARY_API,
filesystem_sets + FILESYSTEM_SET_PRIVILEGED_API,
filesystem_sets + FILESYSTEM_SET_TEMPORARY)
if (nulstr_contains(fs->value, fstype))
return true;
/* Filesystems not present in the internal database */