summaryrefslogtreecommitdiffstats
path: root/utils/utils_helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/utils_helper.h')
-rw-r--r--utils/utils_helper.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/utils_helper.h b/utils/utils_helper.h
index bada86b..520c14f 100644
--- a/utils/utils_helper.h
+++ b/utils/utils_helper.h
@@ -48,6 +48,23 @@
var = conv((const char *)value); \
}
+#define TAGLIB_PARSE_SEGMENTED_LINE(phrase_index, var, line) \
+ phrase_token_t var = null_token; \
+ { \
+ gchar ** strs = g_strsplit_set(line, " \t", 2); \
+ assert(2 == g_strv_length(strs)); \
+ \
+ phrase_token_t token = atoi(strs[0]); \
+ const char * phrase = strs[1]; \
+ if (null_token != token) \
+ assert(taglib_validate_token_with_string \
+ (phrase_index, token, phrase)); \
+ \
+ var = token; \
+ \
+ g_strfreev(strs); \
+ }
+
static bool load_phrase_index(FacadePhraseIndex * phrase_index) {
MemoryChunk * chunk = NULL;