summaryrefslogtreecommitdiffstats
path: root/utils/utils_helper.h
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-10-19 13:44:33 +0800
committerPeng Wu <alexepico@gmail.com>2012-10-19 13:55:12 +0800
commitaee9198d0a266429436dfbde4660baeb47429c4b (patch)
treecab25703aa31ac20d23fa1933775076597d51a9d /utils/utils_helper.h
parent3d9959ed830c4ae5bc7b4f7a525f25f34fc67313 (diff)
downloadlibpinyin-aee9198d0a266429436dfbde4660baeb47429c4b.tar.gz
libpinyin-aee9198d0a266429436dfbde4660baeb47429c4b.tar.xz
libpinyin-aee9198d0a266429436dfbde4660baeb47429c4b.zip
fixes utils helper
Diffstat (limited to 'utils/utils_helper.h')
-rw-r--r--utils/utils_helper.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/utils_helper.h b/utils/utils_helper.h
index 520c14f..6a90cce 100644
--- a/utils/utils_helper.h
+++ b/utils/utils_helper.h
@@ -50,9 +50,13 @@
#define TAGLIB_PARSE_SEGMENTED_LINE(phrase_index, var, line) \
phrase_token_t var = null_token; \
- { \
+ do { \
+ if (0 == strlen(line)) \
+ break; \
+ \
gchar ** strs = g_strsplit_set(line, " \t", 2); \
- assert(2 == g_strv_length(strs)); \
+ if (2 != g_strv_length(strs)) \
+ assert(false); \
\
phrase_token_t token = atoi(strs[0]); \
const char * phrase = strs[1]; \
@@ -63,7 +67,7 @@
var = token; \
\
g_strfreev(strs); \
- }
+ } while(false);
static bool load_phrase_index(FacadePhraseIndex * phrase_index) {