diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2013-06-24 13:57:52 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2013-06-24 13:57:52 +0200 |
commit | 12955fcda60607971bc6344ecc2abbeae75560f1 (patch) | |
tree | d0fc25dd0105a6d8d03d81747f7523470b3a8315 /callouts | |
parent | 71b5b77b3a5b4b6ad734e3c21be0d3d116a07d85 (diff) |
dispatcher: fix tests after ac536c212473dadbf49b9e0129f745f497728c7d
We need to use G_TYPE_STRV instead of DBUS_TYPE_G_ARRAY_OF_STRING, because
G_TYPE_STRV will be the type that will come to the dispatcher over D-Bus.
Diffstat (limited to 'callouts')
-rw-r--r-- | callouts/tests/test-dispatcher-envp.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index a93882f470..65f3b538b9 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -101,14 +101,14 @@ value_hash_add_uint (GHashTable *hash, static void value_hash_add_strv (GHashTable *hash, - const char *key, - GPtrArray *array) + const char *key, + char **strv) { GValue *value; value = g_slice_new0 (GValue); - g_value_init (value, DBUS_TYPE_G_ARRAY_OF_STRING); - g_value_take_boxed (value, array); + g_value_init (value, G_TYPE_STRV); + g_value_take_boxed (value, strv); value_hash_add (hash, key, value); } @@ -255,13 +255,15 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e { char *tmp; char **split, **iter; - GPtrArray *domains; GSList *list; GValue *val; *out_props = value_hash_create (); /* search domains */ + /* Use char** for domains. (DBUS_TYPE_G_ARRAY_OF_STRING of NMIP4Config + * becomes G_TYPE_STRV when sending the value over D-Bus) + */ tmp = g_key_file_get_string (kf, section, "domains", error); if (tmp == NULL) return FALSE; @@ -269,14 +271,10 @@ parse_ip4 (GKeyFile *kf, GHashTable **out_props, const char *section, GError **e g_free (tmp); if (g_strv_length (split) > 0) { - domains = g_ptr_array_sized_new (g_strv_length (split)); - for (iter = split; iter && *iter; iter++) { - if (strlen (g_strstrip (*iter))) - g_ptr_array_add (domains, g_strdup (*iter)); - } - value_hash_add_strv (*out_props, "domains", domains); + for (iter = split; iter && *iter; iter++) + g_strstrip (*iter); + value_hash_add_strv (*out_props, "domains", split); } - g_strfreev (split); /* nameservers */ if (!add_uint_array (kf, *out_props, "ip4", "nameservers", error)) |