X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Ftracecontext.c;h=28c279670efe89e53272cabc77bb5a378934500f;hb=9d239bd92ef3198e80333c703f3ab8ff8cdaeaf7;hp=95462d9677bf50e3577cb5350417e1b3c90090c1;hpb=d3d34f492bdbd2326ff345d8d1f84998df19f459;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index 95462d96..28c27967 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -385,18 +385,19 @@ void lttv_tracefile_context_add_hooks(LttvTracefileContext *self, LttvHooks *event, LttvHooksById *event_by_id) { - guint i; + guint i, index; LttvHooks *hook; lttv_hooks_call(before_tracefile, self); lttv_hooks_add_list(self->event, event); - if(event_by_id != NULL) - for(i = 0; i < lttv_hooks_by_id_max_id(event_by_id); i++) { - hook = lttv_hooks_by_id_find(self->event_by_id, i); - lttv_hooks_add_list(hook, lttv_hooks_by_id_get(event_by_id, i)); + if(event_by_id != NULL) { + for(i = 0; i < event_by_id->array->len; i++) { + index = g_array_index(event_by_id->array, guint, i); + hook = lttv_hooks_by_id_find(self->event_by_id, index); + lttv_hooks_add_list(hook, lttv_hooks_by_id_get(event_by_id, index)); } - + } } void lttv_tracefile_context_remove_hooks(LttvTracefileContext *self, @@ -404,18 +405,19 @@ void lttv_tracefile_context_remove_hooks(LttvTracefileContext *self, LttvHooks *event, LttvHooksById *event_by_id) { - guint i; + guint i, index; LttvHooks *hook; - lttv_hooks_remove_list(self->event, event); - if(event_by_id != NULL) - for(i = 0; i < lttv_hooks_by_id_max_id(event_by_id); i++) { - hook = lttv_hooks_by_id_get(self->event_by_id, i); + if(event_by_id != NULL) { + for(i = 0; i < event_by_id->array->len; i++) { + index = g_array_index(event_by_id->array, guint, i); + hook = lttv_hooks_by_id_get(self->event_by_id, index); if(hook != NULL) - lttv_hooks_remove_list(hook, lttv_hooks_by_id_get(event_by_id, i)); + lttv_hooks_remove_list(hook, lttv_hooks_by_id_get(event_by_id, index)); } + } lttv_hooks_call(after_tracefile, self); } @@ -869,6 +871,7 @@ lttv_trace_find_hook(LttTrace *t, GQuark facility, GQuark event, thf = &g_array_index(th->fac_index, LttvTraceHookByFacility, fac_id); g_array_index(th->fac_list, LttvTraceHookByFacility*, 0) = thf; + thf->h = h; thf->id = ltt_eventtype_id(et); thf->f1 = find_field(et, field1);