Added unique ids for debugging
authorFlorian Liekweg <liekweg@ipd.info.uni-karlsruhe.de>
Thu, 18 Nov 2004 16:35:46 +0000 (16:35 +0000)
committerFlorian Liekweg <liekweg@ipd.info.uni-karlsruhe.de>
Thu, 18 Nov 2004 16:35:46 +0000 (16:35 +0000)
[r4427]

ir/ana2/qset.c
ir/ana2/qset.h

index 03ee5b8..0aeb7f9 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /*
- * Time-stamp: <09.11.2004 11:42:19h liekweg>
+ * Time-stamp: <11.11.2004 16:42:15h liekweg>
  * Project:     libFIRM
  * File name:   ir/ana2/qset.c
  * Purpose:     yet another set implementation
 # include "timing.h"
 # include "qset.h"
 
+/* local globals */
+int qset_id = 0;
+
 /* local protos */
 
-/* Check whether the given list of sortables is sorted. */
 # ifdef UNSINN
+/* Check whether the given list of sortables is sorted. */
 static void q_check (sortable_t*, const int);
 # endif /* defined UNSINN */
+
 /* Test whether the given val is among values.  Return the index of
    val in values, or -1. */
 static int q_test (sortable_t*, const sortable_t, const int);
+
 /* Sort n_elems entries  in 'values' */
 static void q_sort (sortable_t*, const int);
 
+/* Compare funktion, meant to be qsort(3)-compatible */
 static __inline__ int sortable_compare (const void *pa, const void *pb)
 {
   const int a = * (unsigned int*) pa;
@@ -444,6 +450,7 @@ qset_t *qset_new (const int n_elems)
   qset->n_slots = n_elems;
   qset->n_elems = 0;
   qset->is_sorted = FALSE;
+  qset->id = qset_id ++;
 
   return (qset);
 }
@@ -683,6 +690,12 @@ sortable_t *qset_next (qset_t *qset)
     return (NULL);
   }
 
+  /* quick fix to skip NULL entries */
+  while ((qset->cursor < qset->n_elems) &&
+         (NULL == qset->values [qset->cursor])) {
+    qset->cursor ++;
+  }
+
   return (qset->values [qset->cursor++]);
 }
 
@@ -711,6 +724,9 @@ int qset_test_main (int argc, char **argv)
 
 /*
   $Log$
+  Revision 1.4  2004/11/18 16:35:45  liekweg
+  Added unique ids for debugging
+
   Revision 1.3  2004/11/09 16:45:36  liekweg
   print pointers
 
index e43c6c5..c8a1f24 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- c -*- */
 
 /*
- * Time-stamp: <08.11.2004 13:29:19h liekweg>
+ * Time-stamp: <11.11.2004 16:42:22h liekweg>
  * Project:     libFIRM
  * File name:   ir/ana2/qset.h
  * Purpose:     yet another set implementation
@@ -34,6 +34,7 @@ typedef struct qset_str
   int n_elems;
   int is_sorted;
   int cursor;                   /* for qset_start/qset_next */
+  int id;
 } qset_t;
 
 
@@ -90,6 +91,9 @@ sortable_t *qset_next (qset_t*);
 
 /*
  $Log$
+ Revision 1.3  2004/11/18 16:35:46  liekweg
+ Added unique ids for debugging
+
  Revision 1.2  2004/11/08 12:32:00  liekweg
  Moved q_* methods into private section