tweak trace context comparison
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 14 Aug 2004 20:52:34 +0000 (20:52 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 14 Aug 2004 20:52:34 +0000 (20:52 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@756 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/tracecontext.c

index 6a5cb931937d330907d258fd9b0b586f49be1849..40b9147ae09e4ace942f5f058c54598d6c32986f 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(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 {
This page took 0.024564 seconds and 4 git commands to generate.