[systemd-commits] 2 commits - src/shared src/systemctl src/test
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sun Oct 27 09:03:46 PDT 2013
src/shared/install.c | 1 -
src/shared/path-lookup.h | 2 ++
src/systemctl/systemctl.c | 4 +---
src/test/test-strv.c | 30 ++++++++++++++++++++++++++++++
4 files changed, 33 insertions(+), 4 deletions(-)
New commits:
commit 02f19706a9fd96e05c9ed16aa55ba3d03d008167
Author: Daniel Buch <boogiewasthere at gmail.com>
Date: Sun Oct 27 12:45:53 2013 +0100
test-strv.c: added STRV_FOREACH and STRV_FOREACH_BACKWARDS
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index c3d536d..de5cef0 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -282,6 +282,34 @@ static void test_strv_append(void) {
assert_se(streq(c[0], "test3"));
}
+static void test_strv_foreach(void) {
+ _cleanup_strv_free_ char **a;
+ unsigned i = 0;
+ char **check;
+
+ a = strv_new("one", "two", "three", NULL);
+
+ assert_se(a);
+
+ STRV_FOREACH(check, a) {
+ assert_se(streq(*check, input_table_multiple[i++]));
+ }
+}
+
+static void test_strv_foreach_backwards(void) {
+ _cleanup_strv_free_ char **a;
+ unsigned i = 2;
+ char **check;
+
+ a = strv_new("one", "two", "three", NULL);
+
+ assert_se(a);
+
+ STRV_FOREACH_BACKWARDS(check, a) {
+ assert_se(streq(*check, input_table_multiple[i--]));
+ }
+}
+
static void test_strv_foreach_pair(void) {
_cleanup_strv_free_ char **a = NULL;
char **x, **y;
@@ -298,6 +326,8 @@ static void test_strv_foreach_pair(void) {
int main(int argc, char *argv[]) {
test_specifier_printf();
+ test_strv_foreach();
+ test_strv_foreach_backwards();
test_strv_foreach_pair();
test_strv_find();
test_strv_find_prefix();
commit fb15be839500c39f6c2f006f45306d439e1a7add
Author: Daniel Buch <boogiewasthere at gmail.com>
Date: Sun Oct 27 12:45:52 2013 +0100
path_lookup: moved _cleanup_lookup_paths_free_ from install.c to path-lookup.h
diff --git a/src/shared/install.c b/src/shared/install.c
index 3bced1a..987b36d 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -44,7 +44,6 @@ typedef struct {
Hashmap *have_installed;
} InstallContext;
-#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
#define _cleanup_install_context_done_ _cleanup_(install_context_done)
static int lookup_paths_init_from_scope(LookupPaths *paths, UnitFileScope scope) {
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
index 9dee85f..a3ef824 100644
--- a/src/shared/path-lookup.h
+++ b/src/shared/path-lookup.h
@@ -36,6 +36,8 @@ typedef enum SystemdRunningAs {
_SYSTEMD_RUNNING_AS_INVALID = -1
} SystemdRunningAs;
+#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
+
const char* systemd_running_as_to_string(SystemdRunningAs i) _const_;
SystemdRunningAs systemd_running_as_from_string(const char *s) _pure_;
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d458c65..87a6985 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4223,7 +4223,7 @@ static int enable_sysv_units(const char *verb, char **args) {
#if defined(HAVE_SYSV_COMPAT) && defined(HAVE_CHKCONFIG)
unsigned f = 1, t = 1;
- LookupPaths paths = {};
+ _cleanup_lookup_paths_free_ LookupPaths paths = {};
if (arg_scope != UNIT_FILE_SYSTEM)
return 0;
@@ -4361,8 +4361,6 @@ static int enable_sysv_units(const char *verb, char **args) {
}
finish:
- lookup_paths_free(&paths);
-
/* Drop all SysV units */
for (f = 0, t = 0; args[f]; f++) {
More information about the systemd-commits
mailing list