* MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <lttv/iattribute.h>
}
}
+
/* Shallow and deep copies */
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)
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);
}
else lttv_iattribute_copy_value(t, v_copy, v);
}
+ return copy;
}
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: