/* intialize the record with the given index entry in the btree. */ int record_init(record* r, btree* bt, node_buf* buf, UInt16 index) { void *p; r-> tree = bt; p = btree_key_by_index(bt,buf,index); if (!p) return -1; p = record_readkey (p, &r->key); if (!p) return -1; /* void *help = p; // se comment below */ p = record_readentry(p, &r->record); /* This was for testing write cache only void * help; help = record_writeentry(help, &r->record); if (p != help) HFSP_ERROR(-1, "Error in write entry"); */ if (!p) return -1; r->node_index = buf->index; r-> keyind = index; return 0; /* fail: return -1; */ }
/* intialize the record with the given index entry in the btree. */ static int record_init(record* r, btree* bt, node_buf* buf, UInt16 index) { void *p; r-> tree = bt; p = btree_key_by_index(bt,buf,index); if (!p) return -1; p = record_readkey (p, &r->key); if (!p) return -1; p = record_readentry(p, &r->record); if (!p) return -1; r->node_index = buf->index; r-> keyind = index; return 0; }
/* intialize the record by searching for the given key in the btree. * * r is umodified on error. */ static int record_init_key(record* r, btree* tree, hfsp_cat_key* key) { int keyind; UInt16 node_index; void *p = record_find_key(tree, key, &keyind, &node_index); if (p) { r -> tree = tree; r -> node_index= node_index; r -> keyind = keyind; r -> key = *key; // Better use a record_key_copy ... p = record_readentry(p, &r->record); if (!p) HFSP_ERROR(-1, "record_init_key: unexpected error"); return 0; } fail: return -1; }