rework Relation_next and HashVector_next to void query handling in HashVector
[rrq/rrqmisc.git] / vector / HashVector.c
index dbf1ab2ee3c6cbeaa17cefff205483e4ebaf1059..ec0e0b41a38e18aed3b4e7f48de3180a66fc4810 100644 (file)
@@ -65,26 +65,17 @@ void *HashVector_find(HashVector *hv,void *key) {
 
 // Find any element at or after the index that admits to the key.
 // Update index and return item.
-void *HashVector_next(HashVector *hv,VectorIndex *index,void *key) {
-    unsigned long i = index? *index : 0;
-    for ( ; i < hv->table.size; i++ ) {
-       void **p = Vector_next_used( &hv->table, &i );
+void *HashVector_next(HashVector *hv,VectorIndex *index) {
+    for ( ; (*index) < hv->table.size; (*index)++ ) {
+       void **p = Vector_next_used( &hv->table, index );
        if ( p == 0 ) {
            break;
        }
        if ( *p && *p != HV_HOLE ) {
-           if ( key && hv->type->haskey( hv->type, *p, key ) == 0 ) {
-               continue;
-           }
-           if ( index ) {
-               (*index) = i;
-           }
            return *p;
        }
     }
-    if ( index ) {
-       (*index) = hv->table.size;
-    }
+    (*index) = hv->table.size;
     return 0;
 }
 
@@ -184,7 +175,7 @@ Vector *HashVector_contents(
     VectorIndex i;
     VectorIndex j = 0;
     for ( i = 0; i < v->size; i++, j++ ) {
-       Vector_set( v, i, HashVector_next( hv, &j, 0 ) );
+       Vector_set( v, i, HashVector_next( hv, &j ) );
     }
     return v;
 }