in.key = word;
in.keylen = len;
- return SFSFindDataOrSave(info, &in, NULL);
+ return SFSFindDataFromSavedOrSave(info, &in, NULL);
}
void*
SFSFindDataOrSave(SFSTree *info, SFSDataIO *in, SFSTreePosition *position) {
+ if ( position )
+ memset(position, 0, sizeof(position));
+
+ return SFSFindDataFromSavedOrSave(info, in, position);
+}
+
+void*
+SFSFindDataFromSavedOrSave(SFSTree *info, SFSDataIO *in, SFSTreePosition *position) {
SFSNode *node = info->node;
SFSNode **pnode = &(info->node);
SFSNodeData *StopLow, *StopHigh, *StopMiddle;
u_int8_t *ptr =(u_int8_t*)in->key;
- if ( position ) {
- position->nodeptr = NULL;
- position->node = NULL;
- position->level = 0;
+ if ( position && position->nodeptr && position->node && in->keylen > position->level ) {
+ node = position->node;
+ pnode = position->nodeptr;
+ ptr += position->level;
}
while( node && !ISEND(ptr, in->key, in->keylen) ) {
} SFSTreePosition;
void* SFSFindDataOrSave(SFSTree *info, SFSDataIO *in, SFSTreePosition *position);
+void* SFSFindDataFromSavedOrSave(SFSTree *info, SFSDataIO *in, SFSTreePosition *position);
void SFSAddSaved(SFSTree *info, SFSDataIO *in, SFSTreePosition *position);
/*