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

@@ -240,12 +240,15 @@ TrEntry trie_load(FILE *file) {
TrNode node;
new_trie_entry(trie, NULL);
CURRENT_TRIE = trie;
if (!(node = core_trie_load(TRIE_ENGINE, file, &trie_data_load))) {
free_trie_entry(trie);
return NULL;
}
TrEntry_trie(trie) = node;
if (FIRST_TRIE)
TrEntry_previous(FIRST_TRIE) = trie;
FIRST_TRIE = trie;
CURRENT_TRIE = trie;
node = core_trie_load(TRIE_ENGINE, file, &trie_data_load);
TrEntry_trie(trie) = node;
return trie;
}