X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;ds=sidebyside;f=vector%2FHashVector.c;h=ec0e0b41a38e18aed3b4e7f48de3180a66fc4810;hb=3d4400773c3361961bcb9f8b6898321f2005a093;hp=dbf1ab2ee3c6cbeaa17cefff205483e4ebaf1059;hpb=58de9483c458a25a691d648ce13b81227c327d03;p=rrq%2Frrqmisc.git diff --git a/vector/HashVector.c b/vector/HashVector.c index dbf1ab2..ec0e0b4 100644 --- a/vector/HashVector.c +++ b/vector/HashVector.c @@ -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; }