value <<= 3;
if ( (*kp)[i] ) {
value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
- } else {
- value += 17;
}
}
+ value += 17;
}
return value;
}
static void *tupleitem_itemkey(void *this,void *item) {
tupleschema *def = (tupleschema *) this;
tuple *tp = (tuple*) item;
- int i, j;
- int keylen = 0;
- for ( i = 0 ; i < def->arity; i++ ) {
- if ( COLUMN[i] ) {
- keylen++;
- }
- }
+ int i;
+ int keylen = def->arity;
void **parts = calloc( keylen, sizeof( void* ) );
- for ( i = 0, j = 0; i < def->arity; i++ ) {
+ for ( i = 0; i < def->arity; i++ ) {
if ( COLUMN[i] ) {
- parts[j++] = COLUMN[i]->itemkey( COLUMN[i], (*tp)[i] );
+ parts[i] = COLUMN[i]->itemkey( COLUMN[i], (*tp)[i] );
}
}
return (void*) parts;
static void tupleitem_releasekey(void *this,void *key) {
tupleschema *def = (tupleschema *) this;
tuple *kp = (tuple*) key;
- int i,j;
- for ( i = 0, j = 0; i < def->arity; i++ ) {
+ int i;
+ for ( i = 0; i < def->arity; i++ ) {
if ( COLUMN[i] ) {
- COLUMN[i]->releasekey( COLUMN[i], (*kp)[j++] );
+ COLUMN[i]->releasekey( COLUMN[i], (*kp)[i] );
}
}
free( key );