From 758f9402d3fcffb5360ef74c105d27070c7b7a09 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 17 Sep 2009 23:57:47 -0400 Subject: Discard the clearance level when matching. Fixes a bug where ranges were causing matches to fail. --- src/mcscolor.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mcscolor.c b/src/mcscolor.c index ebe5be0..b3df206 100644 --- a/src/mcscolor.c +++ b/src/mcscolor.c @@ -97,12 +97,17 @@ static int check_dominance(const char *pattern, const char *raw) { struct av_decision avd; int rc = -1; context_t my_tmp; - const char *raw_range; + char *raw_range; con = context_new(raw); if (!con) return -1; - raw_range = context_range_get(con); + raw_range = strdup(context_range_get(con)); + if (!raw_range) { + context_free(con); + return -1; + } + *strchrnul(raw_range, '-') = '\0'; my_tmp = context_new(my_context); if (!my_tmp) { @@ -129,6 +134,7 @@ static int check_dominance(const char *pattern, const char *raw) { rc = (bit & avd.allowed) != bit; out: + free(raw_range); free(ctx); context_free(my_tmp); context_free(con); -- cgit v1.2.3