X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fattribute.c;h=176772dee2e77e35e29d7225fde9dd9cf9d2ff89;hb=c87b2140ab19ea9d568e928b2609c71d3ba34562;hp=a0452b5fdc0e324c523ad49e81660c291403df99;hpb=ffd54a901f0062e31ffb35a316de9d8b17104abb;p=lttv.git diff --git a/ltt/branches/poly/lttv/attribute.c b/ltt/branches/poly/lttv/attribute.c index a0452b5f..176772de 100644 --- a/ltt/branches/poly/lttv/attribute.c +++ b/ltt/branches/poly/lttv/attribute.c @@ -103,7 +103,7 @@ lttv_attribute_get_by_name(LttvAttribute *self, LttvAttributeName name, p = g_hash_table_lookup(self->names, GUINT_TO_POINTER(name)); if(p == NULL) return LTTV_NONE; - i = POINTER_TO_GUINT(p); + i = GPOINTER_TO_UINT(p); i--; a = &g_array_index(self->attributes, Attribute, i); *v = address_of_value(a->type, &(a->value)); @@ -151,8 +151,10 @@ lttv_attribute_remove(LttvAttribute *self, unsigned i) /* The element used to replace the removed element has its index entry all wrong now. Reinsert it with its new position. */ - g_hash_table_remove(self->names, GUINT_TO_POINTER(a->name)); - g_hash_table_insert(self->names, GUINT_TO_POINTER(a->name), GUINT_TO_POINTER(i + 1)); + if(self->attributes->len != i){ + g_hash_table_remove(self->names, GUINT_TO_POINTER(a->name)); + g_hash_table_insert(self->names, GUINT_TO_POINTER(a->name), GUINT_TO_POINTER(i + 1)); + } } void @@ -258,7 +260,7 @@ attribute_instance_init (GTypeInstance *instance, gpointer g_class) static void attribute_finalize (LttvAttribute *self) { - g_hash_table_free(self->names); + g_hash_table_destroy(self->names); g_array_free(self->attributes, TRUE); G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_ATTRIBUTE_GET_CLASS(self)))->finalize(G_OBJECT(self)); }