From 55d001514e1ee193af13416cc81d443abb092a70 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 13 May 2018 09:36:18 +0100 Subject: [PATCH] Don't print 'Bad rules data in ...' if there are no rules in the dictionary. --- src/libespeak-ng/dictionary.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libespeak-ng/dictionary.c b/src/libespeak-ng/dictionary.c index e5f72131..92bf8d1f 100644 --- a/src/libespeak-ng/dictionary.c +++ b/src/libespeak-ng/dictionary.c @@ -138,9 +138,12 @@ static void InitGroups(Translator *tr) memset(tr->groups3, 0, sizeof(tr->groups3)); p = tr->data_dictrules; - while (*p != 0) { + // If there are no rules in the dictionary, compile_dictrules will not + // write a RULE_GROUP_START (written in the for loop), but will write + // a RULE_GROUP_END. + if (*p != RULE_GROUP_END) while (*p != 0) { if (*p != RULE_GROUP_START) { - fprintf(stderr, "Bad rules data in '%s_dict' at 0x%x\n", dictionary_name, (unsigned int)(p - tr->data_dictrules)); + fprintf(stderr, "Bad rules data in '%s_dict' at 0x%x (%c)\n", dictionary_name, (unsigned int)(p - tr->data_dictrules), p); break; } p++;