summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2012-05-23 13:37:21 -0400
committerDavid Zeuthen <davidz@redhat.com>2012-05-23 13:37:21 -0400
commit224f7b892478302dccbe7e567b013d3c73d376fd (patch)
treec0072874be3d6641dcea07f9ab79711ec0d89499 /src
parent13ac46935c801d9253971abee88a7d71c36c268e (diff)
Make polkit_details_insert() remove the key if passed value is NULL
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/polkit/polkitdetails.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/polkit/polkitdetails.c b/src/polkit/polkitdetails.c
index 9c5c7e7..07a6f63 100644
--- a/src/polkit/polkitdetails.c
+++ b/src/polkit/polkitdetails.c
@@ -142,6 +142,8 @@ polkit_details_lookup (PolkitDetails *details,
* @value: (allow-none): A value.
*
* Inserts a copy of @key and @value on @details.
+ *
+ * If @value is %NULL, the key will be removed.
*/
void
polkit_details_insert (PolkitDetails *details,
@@ -155,7 +157,10 @@ polkit_details_insert (PolkitDetails *details,
g_str_equal,
g_free,
g_free);
- g_hash_table_insert (details->hash, g_strdup (key), g_strdup (value));
+ if (value != NULL)
+ g_hash_table_insert (details->hash, g_strdup (key), g_strdup (value));
+ else
+ g_hash_table_remove (details->hash, key);
}
/**