aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-10 19:30:18 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:12 +0100
commitba806ffbdf11a63993e4b5d64cca085d385dc1bc (patch)
tree555be21f84710cc74cb8e4421f5f0b6a00227abf
parent915901599554b57e386ee4110efcd3c79b87a2cb (diff)
object: avoid extra class property key duplication
Like object properties, no need to duplicate property name, as it is owned already by ObjectProperty value. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200110153039.1379601-6-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--qom/object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/qom/object.c b/qom/object.c
index dcb686348b..e921363c0a 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -311,7 +311,7 @@ static void type_initialize(TypeImpl *ti)
memcpy(ti->class, parent->class, parent->class_size);
ti->class->interfaces = NULL;
ti->class->properties = g_hash_table_new_full(
- g_str_hash, g_str_equal, g_free, object_property_free);
+ g_str_hash, g_str_equal, NULL, object_property_free);
for (e = parent->class->interfaces; e; e = e->next) {
InterfaceClass *iface = e->data;
@@ -343,7 +343,7 @@ static void type_initialize(TypeImpl *ti)
}
} else {
ti->class->properties = g_hash_table_new_full(
- g_str_hash, g_str_equal, g_free, object_property_free);
+ g_str_hash, g_str_equal, NULL, object_property_free);
}
ti->class->type = ti;
@@ -1187,7 +1187,7 @@ object_class_property_add(ObjectClass *klass,
prop->release = release;
prop->opaque = opaque;
- g_hash_table_insert(klass->properties, g_strdup(name), prop);
+ g_hash_table_insert(klass->properties, prop->name, prop);
return prop;
}