changeset 84:2e9d4fc2adc5

Small bugfix and cosmetics
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 15 Jul 2008 10:44:18 +0900
parents ff4e4c50bc84
children 8e59962f1e58
files waaad/dictionary.c waaad/message.c
diffstat 2 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/waaad/dictionary.c	Mon Jul 14 18:31:55 2008 +0900
+++ b/waaad/dictionary.c	Tue Jul 15 10:44:18 2008 +0900
@@ -1764,18 +1764,21 @@
 	int ret = 0;
 	_dict_list_t * li;
 	
-	TRACE_DEBUG (FULL, "Iterating on rules (%p, %p, %p).", parent, data, cb);
-	
 	/* Check parameters */
 	if (!parent || verify_object(_O(parent))) {
-		TRACE_DEBUG (FULL, "EINVAL." );
+		TRACE_DEBUG (FULL, "invalid parent object EINVAL." );
 		return EINVAL;
 	}
 	if (  (_O(parent)->type != DICT_COMMAND) 
 	   && ((_O(parent)->type != DICT_AVP) || (_O(parent)->data.avp.avp_basetype != AVP_TYPE_GROUPED) ) ) {
-		TRACE_DEBUG (FULL, "EINVAL." );
+		TRACE_DEBUG (FULL, "wrong parent EINVAL." );
 		return EINVAL;
 	}
+	TRACE_DEBUG (FULL, "Iterating on rules of %s: '%s'.", 
+			_OBINFO(parent).name, 
+			_O(parent)->type == DICT_COMMAND ? 
+				  _O(parent)->data.cmd.cmd_name
+				: _O(parent)->data.avp.avp_name);
 	
 	/* Acquire the read lock  */
 	ret = pthread_rwlock_rdlock(&dict_lock);
--- a/waaad/message.c	Mon Jul 14 18:31:55 2008 +0900
+++ b/waaad/message.c	Tue Jul 15 10:44:18 2008 +0900
@@ -1158,12 +1158,28 @@
 	
 	/* Get statistics of the AVP concerned by this rule in the message instance */
 	_mpr_stat_avps( rule->rule_avp, _data->sentinel, &count, &first, &last);
-	TRACE_DEBUG(FULL, "Found %d instances, first is %d, last is %d (from end).", count, first, last);
+	{
+		dict_avp_data_t avpdata;
+		int _ret = 0;
+		_ret = dict_getval(rule->rule_avp, &avpdata);
+		
+		TRACE_DEBUG(FULL, "Checking rule: p:%d(%d) m/M/t:%2d/%2d/%d. Counted %d (first: %d, last:%d) of AVP '%s'", 
+					rule->rule_position,
+					rule->rule_order,
+					rule->rule_min,
+					rule->rule_max,
+					rule->rule_template, 
+					count, 
+					first, 
+					last,
+					(_ret == 0) ? avpdata.avp_name : "???"
+				);
+	}
 	
 	/* Now check the rule is not conflicting */
 	
 	/* Check the "min" value */
-	if (rule->rule_min == -1) {
+	if ((min = rule->rule_min) == -1) {
 		if (rule->rule_position == RULE_OPTIONAL)
 			min = 0;
 		else
@@ -1217,8 +1233,9 @@
 	ret = 0;
 	
 end:
-	if (ret == EBADMSG)
+	if (ret == EBADMSG) {
 		_data->ruleavp = rule->rule_avp;
+	}
 
 	return ret;
 }
"Welcome to our mercurial repository"