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

Daniel P. Berrange berrange at redhat.com
Tue Jun 3 14:24:04 UTC 2014


On Tue, Jun 03, 2014 at 04:08:08PM +0200, Giuseppe Scrivano wrote:
> 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);
>  }

ACK


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libosinfo mailing list