projects
/
platform
/
upstream
/
libpinyin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c71bfd4
)
improves pinyin_save
author
Peng Wu
<alexepico@gmail.com>
Mon, 12 Mar 2012 05:55:53 +0000
(13:55 +0800)
committer
Peng Wu
<alexepico@gmail.com>
Mon, 12 Mar 2012 05:55:53 +0000
(13:55 +0800)
src/pinyin.cpp
patch
|
blob
|
history
diff --git
a/src/pinyin.cpp
b/src/pinyin.cpp
index 5f6ebc63542f639baf304ccbdbac5fb99972973c..b8726f6e91fee065e92b2297c287688ef8ff45f8 100644
(file)
--- a/
src/pinyin.cpp
+++ b/
src/pinyin.cpp
@@
-215,8
+215,12
@@
bool pinyin_save(pinyin_context_t * context){
g_free(filename);
delete newlog;
+ gchar * tmpfilename = g_build_filename(context->m_user_dir,
+ "user.db.tmp", NULL);
filename = g_build_filename(context->m_user_dir, "user.db", NULL);
- context->m_user_bigram->save_db(filename);
+ context->m_user_bigram->save_db(tmpfilename);
+ rename(tmpfilename, filename);
+ g_free(tmpfilename);
g_free(filename);
mark_version(context->m_user_dir);