defs: rework CONF_DIRS_NULSTR() macro
The macro is generically useful for putting together search paths, hence let's make it truly generic, by dropping the implicit ".d" appending it does, and leave that to the caller. Also rename it from CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about dirs that way, but any kind of file system path. Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to _CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that it's internal.
This commit is contained in:
+13
-11
@@ -76,17 +76,19 @@
|
||||
#define NOTIFY_FD_MAX 768
|
||||
#define NOTIFY_BUFFER_MAX PIPE_BUF
|
||||
|
||||
/* Return a nulstr for a standard cascade of configuration directories,
|
||||
* suitable to pass to conf_files_list_nulstr or config_parse_many. */
|
||||
#define CONF_DIRS_NULSTR(n) \
|
||||
"/etc/" n ".d\0" \
|
||||
"/run/" n ".d\0" \
|
||||
"/usr/local/lib/" n ".d\0" \
|
||||
"/usr/lib/" n ".d\0" \
|
||||
CONF_DIR_SPLIT_USR(n)
|
||||
|
||||
#ifdef HAVE_SPLIT_USR
|
||||
#define CONF_DIR_SPLIT_USR(n) "/lib/" n ".d\0"
|
||||
#define _CONF_PATHS_SPLIT_USR(n) "/lib/" n "\0"
|
||||
#else
|
||||
#define CONF_DIR_SPLIT_USR(n)
|
||||
#define _CONF_PATHS_SPLIT_USR(n)
|
||||
#endif
|
||||
|
||||
/* Return a nulstr for a standard cascade of configuration paths,
|
||||
* suitable to pass to conf_files_list_nulstr() or config_parse_many()
|
||||
* to implement drop-in directories for extending configuration
|
||||
* files. */
|
||||
#define CONF_PATHS_NULSTR(n) \
|
||||
"/etc/" n "\0" \
|
||||
"/run/" n "\0" \
|
||||
"/usr/local/lib/" n "\0" \
|
||||
"/usr/lib/" n "\0" \
|
||||
_CONF_PATHS_SPLIT_USR(n)
|
||||
|
||||
Reference in New Issue
Block a user