}
static int capture_item(vector *pv,unsigned long ix,void *item,void *data) {
- if ( item != HV_HOLE ) {
+ if ( item && item != HV_HOLE ) {
hashvector_add( (hashvector *) data, item );
}
return 0;
if ( new_size < hv->table.size ) {
vector_resize( &tmp.table, 0, capture_item, hv );
} else {
- vector_iterate( &tmp.table, iter_item, hv );
+ vector_iterate( &tmp.table, 0, iter_item, hv );
}
}
}
unsigned long from = 0;
unsigned long to = 0;
- while ( to < hv->fill ) {
- void **slot = vector_next_used( &hv->table, &from, 0, 0 );
- if ( slot ) {
- if ( *slot != HV_HOLE ) {
- vector_set( pv, to++, *slot );
- }
- from++;
- } else {
+ for ( ; to < hv->fill; from++ ) {
+ void **slot = vector_next_used( &hv->table, &from );
+ if ( slot == 0 ) {
break;
}
+ if ( *slot != HV_HOLE ) {
+ vector_set( pv, to++, *slot );
+ }
}
return 0;
}