added a few debug checks and a fix for deallocation
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40200
This commit is contained in:
parent
5fc2918377
commit
ef296710c6
@ -263,7 +263,7 @@ void sm_trie_destroy(Trie *trie)
|
||||
{
|
||||
free(trie->base);
|
||||
free(trie->stringtab);
|
||||
free(trie);
|
||||
delete trie;
|
||||
}
|
||||
|
||||
bool sm_trie_retrieve(Trie *trie, const char *key, void **value)
|
||||
@ -424,9 +424,11 @@ bool sm_trie_insert(Trie *trie, const char *key, void *value)
|
||||
|
||||
if (incoming_base + incoming_limit > trie->baseSize)
|
||||
{
|
||||
incoming_limit = trie->baseSize - incoming_limit;
|
||||
incoming_limit = trie->baseSize - incoming_base;
|
||||
}
|
||||
|
||||
assert(incoming_limit > 0 && incoming_limit <= 255);
|
||||
|
||||
for (unsigned int i=1; i<=255; i++,cur++)
|
||||
{
|
||||
if (cur->mode == Node_Arc || cur->mode == Node_Term)
|
||||
@ -707,6 +709,8 @@ bool sm_trie_insert(Trie *trie, const char *key, void *value)
|
||||
|
||||
/* Phew! */
|
||||
return true;
|
||||
} else {
|
||||
assert(node->mode == Node_Arc);
|
||||
}
|
||||
}
|
||||
lastidx = curidx;
|
||||
|
Loading…
Reference in New Issue
Block a user