PolicyKit: Branch 'wip/js-rule-files'

David Zeuthen david at kemper.freedesktop.org
Wed May 23 10:38:03 PDT 2012


 src/polkit/polkitdetails.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 224f7b892478302dccbe7e567b013d3c73d376fd
Author: David Zeuthen <davidz at redhat.com>
Date:   Wed May 23 13:37:21 2012 -0400

    Make polkit_details_insert() remove the key if passed value is NULL
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

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);
 }
 
 /**


More information about the hal-commit mailing list