projects
/
rrq
/
rrqmisc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
expanded tests
[rrq/rrqmisc.git]
/
vector
/
tupleitem.c
diff --git
a/vector/tupleitem.c
b/vector/tupleitem.c
index f3dfe2c70b0aff012c7b39397f3881817148bd81..2a4a01a7dc6cc96efde2a08a2af3d92bdaf45ee0 100644
(file)
--- a/
vector/tupleitem.c
+++ b/
vector/tupleitem.c
@@
-32,10
+32,9
@@
static unsigned long tupleitem_hashcode(void *this,void *key) {
value <<= 3;
if ( (*kp)[i] ) {
value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
value <<= 3;
if ( (*kp)[i] ) {
value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
- } else {
- value += 17;
}
}
}
}
+ value += 17;
}
return value;
}
}
return value;
}
@@
-67,17
+66,12
@@
static int tupleitem_haskey(void *this,void *item,void *key) {
static void *tupleitem_itemkey(void *this,void *item) {
tupleschema *def = (tupleschema *) this;
tuple *tp = (tuple*) item;
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* ) );
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] ) {
if ( COLUMN[i] ) {
- parts[
j++
] = COLUMN[i]->itemkey( COLUMN[i], (*tp)[i] );
+ parts[
i
] = COLUMN[i]->itemkey( COLUMN[i], (*tp)[i] );
}
}
return (void*) parts;
}
}
return (void*) parts;
@@
-90,10
+84,10
@@
static void *tupleitem_itemkey(void *this,void *item) {
static void tupleitem_releasekey(void *this,void *key) {
tupleschema *def = (tupleschema *) this;
tuple *kp = (tuple*) key;
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] ) {
if ( COLUMN[i] ) {
- COLUMN[i]->releasekey( COLUMN[i], (*kp)[
j++
] );
+ COLUMN[i]->releasekey( COLUMN[i], (*kp)[
i
] );
}
}
free( key );
}
}
free( key );