push back width
[lttv.git] / ltt / branches / poly / lttv / lttv / tracecontext.c
index 3af6045ca5606c3bc5665df205180624108430c5..601208e8c356bbf95dfb18221f8dbe3a459bc362 100644 (file)
 
 gint compare_tracefile(gconstpointer a, gconstpointer b)
 {
-  gint comparison;
+  gint comparison = 0;
 
   const LttvTracefileContext *trace_a = (const LttvTracefileContext *)a;
-
   const LttvTracefileContext *trace_b = (const LttvTracefileContext *)b;
 
-  if(trace_a == trace_b) return 0;
-  comparison = ltt_time_compare(trace_a->timestamp, trace_b->timestamp);
-  if(comparison != 0) return comparison;
-  if(trace_a->index < trace_b->index) return -1;
-  else if(trace_a->index > trace_b->index) return 1;
-  if(trace_a->t_context->index < trace_b->t_context->index) return -1;
-  else if(trace_a->t_context->index > trace_b->t_context->index) return 1;
-  
-  g_assert(FALSE);
-  return 0; /* This should never happen */
+  if(trace_a != trace_b) {
+    comparison = ltt_time_compare(trace_a->timestamp, trace_b->timestamp);
+    if(comparison == 0) {
+      if(trace_a->index < trace_b->index) comparison = -1;
+      else if(trace_a->index > trace_b->index) comparison = 1;
+      else if(trace_a->t_context->index < trace_b->t_context->index) 
+        comparison = -1;
+      else if(trace_a->t_context->index > trace_b->t_context->index)
+        comparison = 1;
+    }
+  }
+  return comparison;
 }
 
 struct _LttvTraceContextPosition {
@@ -683,7 +684,7 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self,
        count >= nb_events ||
      (end_position!=NULL&&lttv_traceset_context_ctx_pos_compare(self,
                                                           end_position) == 0)||
-       ltt_time_compare(tfc->timestamp, end) >= 0)
+       ltt_time_compare(end, tfc->timestamp) <= 0)
     {
       return count;
     }
This page took 0.023147 seconds and 4 git commands to generate.