summaryrefslogtreecommitdiff
path: root/src/shared/conf-files.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-29 19:53:43 +0100
committerLennart Poettering <lennart@poettering.net>2013-10-29 19:53:43 +0100
commit250a918dc4c8a15d927deecc3b3f6a0604657ae4 (patch)
tree18faf995d700c26c67ad500b81e7cce007bc0b95 /src/shared/conf-files.c
parent7b1132f60d2a447c31556c23ea90ea31447ac557 (diff)
strv: introduce new strv_from_stdarg_alloca() macro to generate a string array from stdarg function parameters
This allows us to turn lists of strings passed in easily into string arrays without having to allocate memory.
Diffstat (limited to 'src/shared/conf-files.c')
-rw-r--r--src/shared/conf-files.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index ed4070c662..7ba4bee43b 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -148,18 +148,12 @@ int conf_files_list_strv(char ***strv, const char *suffix, const char *root, con
}
int conf_files_list(char ***strv, const char *suffix, const char *root, const char *dir, ...) {
- _cleanup_strv_free_ char **dirs = NULL;
- va_list ap;
+ char **dirs;
assert(strv);
assert(suffix);
- va_start(ap, dir);
- dirs = strv_new_ap(dir, ap);
- va_end(ap);
-
- if (!dirs)
- return -ENOMEM;
+ dirs = strv_from_stdarg_alloca(dir);
return conf_files_list_strv_internal(strv, suffix, root, dirs);
}