X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fiattribute.c;h=a447192e9c20b4fa2d8d1dcb6ad2dac728034c1c;hb=3813c77b03566b292b48f5687cf022b68afeb75d;hp=ba17e3a23fd1167f9da632fc0c7a6361a802e367;hpb=d8f124de0295aea546b6debf5945bfeea2bbeb2a;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/iattribute.c b/ltt/branches/poly/lttv/lttv/iattribute.c index ba17e3a2..a447192e 100644 --- a/ltt/branches/poly/lttv/lttv/iattribute.c +++ b/ltt/branches/poly/lttv/lttv/iattribute.c @@ -16,6 +16,9 @@ * MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include @@ -174,6 +177,7 @@ gboolean lttv_iattribute_find_by_path(LttvIAttribute *self, char *path, } } + /* Shallow and deep copies */ LttvIAttribute *lttv_iattribute_shallow_copy(LttvIAttribute *self) @@ -190,13 +194,14 @@ LttvIAttribute *lttv_iattribute_shallow_copy(LttvIAttribute *self) int nb_attributes = lttv_iattribute_get_number(self); - copy = LTTV_IATTRIBUTE(g_object_new(G_OBJECT_TYPE(self),NULL)); + copy = LTTV_IATTRIBUTE_GET_CLASS(self)->new_attribute(NULL); for(i = 0 ; i < nb_attributes ; i++) { t = lttv_iattribute_get(self, i, &name, &v); v_copy = lttv_iattribute_add(copy, name, t); lttv_iattribute_copy_value(t, v_copy, v); } + return copy; } LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self) @@ -213,7 +218,7 @@ LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self) int nb_attributes = lttv_iattribute_get_number(self); - copy = LTTV_IATTRIBUTE(g_object_new(G_OBJECT_TYPE(self), NULL)); + copy = LTTV_IATTRIBUTE_GET_CLASS(self)->new_attribute(NULL); for(i = 0 ; i < nb_attributes ; i++) { t = lttv_iattribute_get(self, i, &name, &v); @@ -224,6 +229,7 @@ LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self) } else lttv_iattribute_copy_value(t, v_copy, v); } + return copy; } void lttv_iattribute_copy_value(LttvAttributeType t, LttvAttributeValue dest, @@ -267,7 +273,8 @@ void lttv_iattribute_copy_value(LttvAttributeType t, LttvAttributeValue dest, break; case LTTV_GOBJECT: - *(dest.v_gobject) = *(src.v_gobject); + *(dest.v_gobject) = *(src.v_gobject); + if(*(dest.v_gobject) != NULL) g_object_ref(*(dest.v_gobject)); break; case LTTV_NONE: