Tries module: when loading a trie from a file, we now check if the file is corrupted before starting loading.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2232 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
ricroc
2008-05-07 14:21:39 +00:00
parent da7a287e49
commit ed339dcb12
5 changed files with 46 additions and 14 deletions

View File

@@ -369,12 +369,15 @@ TrEntry itrie_load(FILE *file) {
TrNode node;
new_itrie_entry(itrie, NULL);
CURRENT_ITRIE = itrie;
if (!(node = core_trie_load(ITRIE_ENGINE, file, &itrie_data_load))) {
free_itrie_entry(itrie);
return NULL;
}
TrEntry_trie(itrie) = node;
if (FIRST_ITRIE)
TrEntry_previous(FIRST_ITRIE) = itrie;
FIRST_ITRIE = itrie;
CURRENT_ITRIE = itrie;
node = core_trie_load(ITRIE_ENGINE, file, &itrie_data_load);
TrEntry_trie(itrie) = node;
return itrie;
}