projects
/
tedtools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e03ac24
)
Add SFSFindDataFromSavedOrSave - to fast insert partially existed strings
author
teodor
<teodor>
Fri, 11 Jul 2008 13:22:39 +0000
(13:22 +0000)
committer
teodor
<teodor>
Fri, 11 Jul 2008 13:22:39 +0000
(13:22 +0000)
sfxstr.c
patch
|
blob
|
history
sfxstr.h
patch
|
blob
|
history
diff --git
a/sfxstr.c
b/sfxstr.c
index
50cbab4
..
3eb12c4
100644
(file)
--- a/
sfxstr.c
+++ b/
sfxstr.c
@@
-149,20
+149,28
@@
SFSFindData(SFSTree *info, char *word, int len) {
in.key = word;
in.keylen = len;
in.key = word;
in.keylen = len;
- return SFSFindDataOrSave(info, &in, NULL);
+ return SFSFindData
FromSaved
OrSave(info, &in, NULL);
}
void*
SFSFindDataOrSave(SFSTree *info, SFSDataIO *in, SFSTreePosition *position) {
}
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;
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
;
- p
osition->node = NULL
;
- p
osition->level = 0
;
+ if ( position
&& position->nodeptr && position->node && in->keylen > position->level
) {
+
node = position->node
;
+ p
node = position->nodeptr
;
+ p
tr += position->level
;
}
while( node && !ISEND(ptr, in->key, in->keylen) ) {
}
while( node && !ISEND(ptr, in->key, in->keylen) ) {
diff --git
a/sfxstr.h
b/sfxstr.h
index
c49ac24
..
283326c
100644
(file)
--- a/
sfxstr.h
+++ b/
sfxstr.h
@@
-192,6
+192,7
@@
typedef struct SFSTreePosition {
} SFSTreePosition;
void* SFSFindDataOrSave(SFSTree *info, SFSDataIO *in, SFSTreePosition *position);
} 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);
/*
void SFSAddSaved(SFSTree *info, SFSDataIO *in, SFSTreePosition *position);
/*