changeset 1179:f5e9b53d6f86

Fix invalid NULL pointer indirection in log
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 04 Jun 2013 18:41:07 +0800
parents 33f223b03b45
children 773498f59520
files extensions/rt_default/rtd_rules.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/rt_default/rtd_rules.c	Mon Jun 03 14:24:22 2013 +0800
+++ b/extensions/rt_default/rtd_rules.c	Tue Jun 04 18:41:07 2013 +0800
@@ -413,7 +413,7 @@
 	struct rule * rul = NULL;
 	
 	TRACE_ENTRY("%d %p %d %p %d %x", ct, criteria, tt, target, score, flags);
-	CHECK_PARAMS((ct < RTD_CRI_MAX) && ((ct == 0) || criteria) && (tt < RTD_TAR_MAX) && target);
+	CHECK_PARAMS((ct < RTD_CRI_MAX) && ((ct == RTD_CRI_ALL) || criteria) && (tt < RTD_TAR_MAX) && target);
 	
 	/* First, search in the TARGET list if we already have this target */
 	for (target_suiv = TARGETS[tt].next; target_suiv != &TARGETS[tt]; target_suiv = target_suiv->next) {
@@ -450,10 +450,10 @@
 	}
 	
 	/* Now, search for the rule position in this target's list */
-	if (ct == 0) {
+	if (ct == RTD_CRI_ALL) {
 		/* Special case: we don't have a criteria -- always create a rule element */
 		CHECK_MALLOC( rul = new_rule(NULL, 0, score) );
-		fd_list_insert_before( &trg->rules[0], &rul->chain );
+		fd_list_insert_before( &trg->rules[RTD_CRI_ALL], &rul->chain );
 	} else {
 		for (rule_suiv = trg->rules[ct].next; rule_suiv != &trg->rules[ct]; rule_suiv = rule_suiv->next) {
 			int cmp;
@@ -535,10 +535,10 @@
 					break;
 				
 				/* First, apply all rules of criteria RTD_CRI_ALL */
-				for ( l = target->rules[0].next; l != &target->rules[0]; l = l->next ) {
+				for ( l = target->rules[RTD_CRI_ALL].next; l != &target->rules[RTD_CRI_ALL]; l = l->next ) {
 					r = (struct rule *)l;
 					cand->score += r->score;
-					TRACE_DEBUG(ANNOYING, "Applied rule {'%s' : '%s' += %d} to candidate '%s'", r->md.plain, target->md.plain, r->score, cand->diamid);
+					TRACE_DEBUG(ANNOYING, "Applied rule {'*' : '%s' += %d} to candidate '%s'", target->md.plain, r->score, cand->diamid);
 				}
 				
 				/* The target is matching this candidate, check if there are additional rules criteria matching this message. */
"Welcome to our mercurial repository"