Merge branch 'dev' into less_memory

This commit is contained in:
wyy 2014-03-19 23:48:03 -07:00
commit 0e33a0a570
6 changed files with 14 additions and 19 deletions

View File

@ -1,3 +1,7 @@
## v2.3.5 is coming
1. 适配低级版本的`g++`,已在`g++ 4.4.7`上测试通过。
## v2.3.4
1. 修改了设计上的问题,删除了`TrieManager`这个类,以避免造成一些可能的隐患。

View File

@ -16,7 +16,7 @@
### 依赖
* g++ (version >= 4.6 recommended);
* g++ (version >= 4.4.7 recommended);
* cmake (version >= 2.8 recommended);
### 下载和安装

View File

@ -136,21 +136,10 @@ namespace CppJieba
size_t now, old, stat;
double tmp, endE, endS;
try
{
path = new int [XYSize];
weight = new double [XYSize];
}
catch(const std::bad_alloc&)
{
LogError("bad_alloc");
return false;
}
if(NULL == path || NULL == weight)
{
LogError("bad_alloc");
return false;
}
path = new int [XYSize];
assert(path);
weight = new double [XYSize];
assert(weight);
//start
for(size_t y = 0; y < Y; y++)

View File

@ -84,7 +84,7 @@ namespace CppJieba
{
if(_stopWords.end() != _stopWords.find(itr->first))
{
itr = wordmap.erase(itr);
wordmap.erase(itr++);
continue;
}

View File

@ -77,8 +77,9 @@ namespace CppJieba
_minLogFreq = MAX_DOUBLE;
_setInitFlag(false);
}
Trie(const string& filePath): Trie()
Trie(const string& filePath)
{
Trie();
_setInitFlag(init(filePath));
}
~Trie()

View File

@ -84,7 +84,8 @@ bool run(int argc, char** argv)
}
int pid = getpid();
string pidStr = to_string(pid);
string pidStr;
string_format(pidStr, "%d", pid);
loadStr2File(val.c_str(), ios::out, pidStr);
LogInfo("write pid[%s] into file[%s]", pidStr.c_str(), val.c_str());