From dc1cad909bb9e6627b62efacda56137621ab293b Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 16 Aug 2004 04:02:44 +0000 Subject: [PATCH] further tweaks on ltt_trace_facility_by_id git-svn-id: http://ltt.polymtl.ca/svn@788 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/tracefile.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 292c2079..061cb743 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -681,8 +681,10 @@ unsigned ltt_trace_eventtype_number(LttTrace *t) { unsigned int i; unsigned count = 0; + unsigned int num = t->facility_number; LttFacility * f; - for(i=0;ifacility_number;i++){ + + for(i=0;ifacilities, i); count += f->event_number; } @@ -696,17 +698,23 @@ LttFacility * ltt_trace_facility_by_id(LttTrace * trace, unsigned id) { LttFacility * facility = NULL; unsigned int i; + unsigned int num = trace->facility_number; + GPtrArray *facilities = trace->facilities; - for(i=0;ifacility_number;i++){ + for(i=0;unlikely(ifacilities,i); - if(likely(id >= iter_facility->base_id && - id < iter_facility->base_id + iter_facility->event_number)) { + (LttFacility*) g_ptr_array_index(facilities,i); + unsigned base_id = iter_facility->base_id; + + if(likely(id >= base_id && + id < base_id + iter_facility->event_number)) { facility = iter_facility; break; + } else { + i++; } } - + return facility; } @@ -1767,7 +1775,7 @@ static inline gint getFieldtypeSize(LttTracefile * t, }else if(likely(fld->field_fixed == 0)){ offset1 = offsetRoot; offset2 = 0; - for(i=0;ichild[i],evD+offset2, trace); offset1 += size; -- 2.34.1