make TrieManager.hpp looks better

This commit is contained in:
aholic 2013-12-17 00:02:48 +08:00
parent 12a4eea111
commit d8e00f7d62

View File

@ -23,11 +23,14 @@ namespace CppJieba
LogError("error when getting md5 for file '%s'", dictpath);
return NULL;
}
else
{
LogInfo("md5 for file '%s': %s", dictpath, md5.c_str());
if (_tries.find(md5) == _tries.end())
if (_tries.find(md5) != _tries.end())
{
LogInfo("find a exits trie for md5: '%s'", md5.c_str());
return _tries[md5.c_str()];
}
LogInfo("create a new trie for md5: '%s'", md5.c_str());
Trie* trie = NULL;
try
@ -40,7 +43,10 @@ namespace CppJieba
return NULL;
}
if (NULL == trie)
{
LogError("get NULL from new trie for file '%s'", dictpath);
return NULL;
}
if (!trie->init())
{
@ -59,13 +65,6 @@ namespace CppJieba
_tries[md5.c_str()] = trie;
return trie;
}
else
{
LogInfo("find a exits trie for md5: '%s'", md5.c_str());
return _tries[md5.c_str()];
}
}
}
static TrieManager& getInstance()
{