mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
basic/path-util: line-break PATH_FOREACH_PREFIX macros
Now I can see what they do :]
This commit is contained in:
parent
296acffe45
commit
f8703ed7e5
@ -98,11 +98,23 @@ int mkfs_exists(const char *fstype);
|
||||
* the tree, to root. Also returns "" (and not "/"!) for the root
|
||||
* directory. Excludes the specified directory itself */
|
||||
#define PATH_FOREACH_PREFIX(prefix, path) \
|
||||
for (char *_slash = ({ path_simplify(strcpy(prefix, path), false); streq(prefix, "/") ? NULL : strrchr(prefix, '/'); }); _slash && ((*_slash = 0), true); _slash = strrchr((prefix), '/'))
|
||||
for (char *_slash = ({ \
|
||||
path_simplify(strcpy(prefix, path), false); \
|
||||
streq(prefix, "/") ? NULL : strrchr(prefix, '/'); \
|
||||
}); \
|
||||
_slash && ((*_slash = 0), true); \
|
||||
_slash = strrchr((prefix), '/'))
|
||||
|
||||
/* Same as PATH_FOREACH_PREFIX but also includes the specified path itself */
|
||||
#define PATH_FOREACH_PREFIX_MORE(prefix, path) \
|
||||
for (char *_slash = ({ path_simplify(strcpy(prefix, path), false); if (streq(prefix, "/")) prefix[0] = 0; strrchr(prefix, 0); }); _slash && ((*_slash = 0), true); _slash = strrchr((prefix), '/'))
|
||||
for (char *_slash = ({ \
|
||||
path_simplify(strcpy(prefix, path), false); \
|
||||
if (streq(prefix, "/")) \
|
||||
prefix[0] = 0; \
|
||||
strrchr(prefix, 0); \
|
||||
}); \
|
||||
_slash && ((*_slash = 0), true); \
|
||||
_slash = strrchr((prefix), '/'))
|
||||
|
||||
char *prefix_root(const char *root, const char *path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user