[Libosinfo] [RFC PATCH 1/5] entity: use g_hash_table_replace instead of remove+insert

Giuseppe Scrivano gscrivan at redhat.com
Tue Jun 3 14:08:08 UTC 2014


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 osinfo/osinfo_entity.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/osinfo/osinfo_entity.c b/osinfo/osinfo_entity.c
index 5c062bc..1212f13 100644
--- a/osinfo/osinfo_entity.c
+++ b/osinfo/osinfo_entity.c
@@ -1,7 +1,7 @@
 /*
  * libosinfo:
  *
- * Copyright (C) 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2009-2012, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -187,9 +187,8 @@ void osinfo_entity_set_param(OsinfoEntity *entity, const gchar *key, const gchar
 
     GList *values = NULL;
 
-    g_hash_table_remove(entity->priv->params, key);
     values = g_list_append(values, g_strdup(value));
-    g_hash_table_insert(entity->priv->params, g_strdup(key), values);
+    g_hash_table_replace(entity->priv->params, g_strdup(key), values);
 }
 
 
-- 
1.9.3




More information about the Libosinfo mailing list