* MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <lttv/traceset.h>
+#include <lttv/iattribute.h>
#include <stdio.h>
/* A trace is a sequence of events gathered in the same tracing session. The
LttvTraceset *lttv_traceset_copy(LttvTraceset *s_orig)
{
- int i;
+ guint i;
LttvTraceset *s;
LttvTrace * trace;
trace = g_ptr_array_index(s_orig->traces, i);
trace->ref_count++;
- /*CHECK this used ltt_trace_copy while it may not be needed. Need to
- define how traces and tracesets are shared */
- g_ptr_array_add(
- s->traces,
- g_ptr_array_index(s_orig->traces, i));
+ g_ptr_array_add(s->traces,
+ trace);
}
s->a = LTTV_ATTRIBUTE(lttv_iattribute_deep_copy(LTTV_IATTRIBUTE(s_orig->a)));
return s;
void lttv_traceset_destroy(LttvTraceset *s)
{
+ guint i;
+
+ for(i=0;i<s->traces->len;i++) {
+ LttvTrace *trace = g_ptr_array_index(s->traces, i);
+ lttv_trace_unref(trace);
+ if(lttv_trace_get_ref_number(trace) == 0)
+ lttv_trace_destroy(trace);
+ }
g_ptr_array_free(s->traces, TRUE);
g_object_unref(s->a);
g_free(s);
{
return t->ref_count;
}
+
+guint lttv_trace_ref(LttvTrace * t)
+{
+ t->ref_count++;
+
+ return t->ref_count;
+}
+
+guint lttv_trace_unref(LttvTrace * t)
+{
+ if(likely(t->ref_count > 0))
+ t->ref_count--;
+
+ return t->ref_count;
+}
+