diff -r 3f655b1b0d93 -r f39394c9d41f bookloupe/counters.c --- a/bookloupe/counters.c Sat Sep 21 18:28:40 2013 +0100 +++ b/bookloupe/counters.c Tue Sep 24 07:22:18 2013 +0100 @@ -1,4 +1,5 @@ #include +#include #include #include "bookloupe.h" #include "counters.h" @@ -44,9 +45,9 @@ return GINT_TO_POINTER((gint)CHAR_SQUOTE); else if (ch==CHAR_LS_QUOTE || ch==CHAR_RS_QUOTE) return GINT_TO_POINTER((gint)CHAR_LS_QUOTE); - else + else if (ch<0x4000 || ch-0x4000>=NO_SPECIAL_COUNTERS) { - g_warning("Matching pair not found for U+%04"G_GINT32_FORMAT"X",ch); + g_warning("Matching pair not found for U+%04" G_GINT32_MODIFIER "X",ch); return GINT_TO_POINTER((gint)ch); } } @@ -96,6 +97,13 @@ return value->open-value->close; } +void counters_reset(struct counters *counters) +{ + if (counters->matching) + g_tree_destroy(counters->matching); + memset(counters,0,sizeof(*counters)); +} + void counters_destroy(struct counters *counters) { if (counters->matching)