stats major rework, with addition of function support
[lttv.git] / ltt / branches / poly / lttv / lttv / iattribute.c
index ba17e3a23fd1167f9da632fc0c7a6361a802e367..a447192e9c20b4fa2d8d1dcb6ad2dac728034c1c 100644 (file)
@@ -16,6 +16,9 @@
  * MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <lttv/iattribute.h>
 
@@ -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:
This page took 0.02386 seconds and 4 git commands to generate.