1.1 --- a/bookloupe/counters.c Sat Sep 21 18:28:40 2013 +0100
1.2 +++ b/bookloupe/counters.c Mon Sep 23 21:18:27 2013 +0100
1.3 @@ -1,4 +1,5 @@
1.4 #include <stdlib.h>
1.5 +#include <string.h>
1.6 #include <glib.h>
1.7 #include "bookloupe.h"
1.8 #include "counters.h"
1.9 @@ -44,9 +45,9 @@
1.10 return GINT_TO_POINTER((gint)CHAR_SQUOTE);
1.11 else if (ch==CHAR_LS_QUOTE || ch==CHAR_RS_QUOTE)
1.12 return GINT_TO_POINTER((gint)CHAR_LS_QUOTE);
1.13 - else
1.14 + else if (ch<0x4000 || ch-0x4000>=NO_SPECIAL_COUNTERS)
1.15 {
1.16 - g_warning("Matching pair not found for U+%04"G_GINT32_FORMAT"X",ch);
1.17 + g_warning("Matching pair not found for U+%04" G_GINT32_MODIFIER "X",ch);
1.18 return GINT_TO_POINTER((gint)ch);
1.19 }
1.20 }
1.21 @@ -96,6 +97,13 @@
1.22 return value->open-value->close;
1.23 }
1.24
1.25 +void counters_reset(struct counters *counters)
1.26 +{
1.27 + if (counters->matching)
1.28 + g_tree_destroy(counters->matching);
1.29 + memset(counters,0,sizeof(*counters));
1.30 +}
1.31 +
1.32 void counters_destroy(struct counters *counters)
1.33 {
1.34 if (counters->matching)