[asterisk-commits] mmichelson: branch mmichelson/npm_fixes r181022 - /team/mmichelson/npm_fixes/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 10 18:49:09 CDT 2009


Author: mmichelson
Date: Tue Mar 10 18:49:06 2009
New Revision: 181022

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181022
Log:
More coding guidelines fixup.


Modified:
    team/mmichelson/npm_fixes/main/pbx.c

Modified: team/mmichelson/npm_fixes/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/mmichelson/npm_fixes/main/pbx.c?view=diff&rev=181022&r1=181021&r2=181022
==============================================================================
--- team/mmichelson/npm_fixes/main/pbx.c (original)
+++ team/mmichelson/npm_fixes/main/pbx.c Tue Mar 10 18:49:06 2009
@@ -1568,28 +1568,37 @@
 	struct match_char *m4;
 	struct ast_exten *e3;
 	
-	if (node && node->x[0] == '.' && !node->x[1]) /* dot and ! will ALWAYS be next match in a matchmore */
+	if (node && node->x[0] == '.' && !node->x[1]) { /* dot and ! will ALWAYS be next match in a matchmore */
 		return node->exten;
+	}
 	
-	if (node && node->x[0] == '!' && !node->x[1])
+	if (node && node->x[0] == '!' && !node->x[1]) {
 		return node->exten;
+	}
 	
-	if (!node || !node->next_char)
+	if (!node || !node->next_char) {
 		return NULL;
+	}
 	
 	m3 = node->next_char;
 
-	if (m3->exten)
+	if (m3->exten) {
 		return m3->exten;
-	for(m4=m3->alt_char; m4; m4 = m4->alt_char) {
-		if (m4->exten)
+	}
+
+	for(m4 = m3->alt_char; m4; m4 = m4->alt_char) {
+		if (m4->exten) {
 			return m4->exten;
-	}
-	for(m4=m3; m4; m4 = m4->alt_char) {
+		}
+	}
+
+	for(m4 = m3; m4; m4 = m4->alt_char) {
 		e3 = trie_find_next_match(m3);
-		if (e3)
+		if (e3) {
 			return e3;
-	}
+		}
+	}
+
 	return NULL;
 }
 
@@ -1625,14 +1634,14 @@
 	else
 		ast_log(LOG_NOTICE,"new_find_extension called with %s on (sub)tree NULL action=%s\n", str, action2str(action));
 #endif
-	for (p=tree; p; p=p->alt_char) {
+	for (p = tree; p; p = p->alt_char) {
 		if (p->is_pattern) {
 			if (p->x[0] == 'N') {
 				if (p->x[1] == 0 && *str >= '2' && *str <= '9' ) {
 #define	NEW_MATCHER_CHK_MATCH	       \
-					if (p->exten && !(*(str+1))) { /* if a shorter pattern matches along the way, might as well report it */             \
+					if (p->exten && !(*(str + 1))) { /* if a shorter pattern matches along the way, might as well report it */             \
 						if (action == E_MATCH || action == E_SPAWN || action == E_FINDLABEL) { /* if in CANMATCH/MATCHMORE, don't let matches get in the way */   \
-							update_scoreboard(score, length+1, spec+p->specificity, p->exten,0,callerid, p->deleted, p);                 \
+							update_scoreboard(score, length + 1, spec + p->specificity, p->exten, 0, callerid, p->deleted, p);                 \
 							if (!p->deleted) {                                                                                           \
 								if (action == E_FINDLABEL) {                                                                             \
 									if (ast_hashtab_lookup(score->exten->peer_label_table, &pattern)) {                                  \
@@ -1640,7 +1649,7 @@
 										return;                                                                                          \
 									}                                                                                                    \
 								} else {                                                                                                 \
-									ast_debug(4,"returning an exact match-- first found-- %s\n", p->exten->exten);                       \
+									ast_debug(4, "returning an exact match-- first found-- %s\n", p->exten->exten);                       \
 									return; /* the first match, by definition, will be the best, because of the sorted tree */           \
 								}                                                                                                        \
 							}                                                                                                            \
@@ -1648,27 +1657,27 @@
 					}
 					
 #define	NEW_MATCHER_RECURSE	           \
-					if (p->next_char && ( *(str+1) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0)                 \
+					if (p->next_char && (*(str + 1) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0)                 \
         	                                       || p->next_char->x[0] == '!')) {                                          \
-						if (*(str+1) || p->next_char->x[0] == '!') {                                                         \
-							new_find_extension(str+1, score, p->next_char, length+1, spec+p->specificity, callerid, label, action); \
+						if (*(str + 1) || p->next_char->x[0] == '!') {                                                         \
+							new_find_extension(str + 1, score, p->next_char, length + 1, spec + p->specificity, callerid, label, action); \
 							if (score->exten)  {                                                                             \
-						        ast_debug(4,"returning an exact match-- %s\n", score->exten->exten);                         \
+						        ast_debug(4 ,"returning an exact match-- %s\n", score->exten->exten);                         \
 								return; /* the first match is all we need */                                                 \
 							}												                                                 \
 						} else {                                                                                             \
-							new_find_extension("/", score, p->next_char, length+1, spec+p->specificity, callerid, label, action);	 \
+							new_find_extension("/", score, p->next_char, length + 1, spec + p->specificity, callerid, label, action);	 \
 							if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {      \
 						        ast_debug(4,"returning a (can/more) match--- %s\n", score->exten ? score->exten->exten :     \
         	                               "NULL");                                                                        \
 								return; /* the first match is all we need */                                                 \
 							}												                                                 \
 						}                                                                                                    \
-					} else if (p->next_char && !*(str+1)) {                                                                  \
+					} else if (p->next_char && !*(str + 1)) {                                                                  \
 						score->canmatch = 1;                                                                                 \
 						score->canmatch_exten = get_canmatch_exten(p);                                                       \
 						if (action == E_CANMATCH || action == E_MATCHMORE) {                                                 \
-					        ast_debug(4,"returning a canmatch/matchmore--- str=%s\n", str);                                  \
+					        ast_debug(4, "returning a canmatch/matchmore--- str=%s\n", str);                                  \
 							return;                                                                                          \
 						}												                                                     \
 					}
@@ -1695,16 +1704,16 @@
 					i++;
 				}
 				if (p->exten && *str2 != '/') {
-					update_scoreboard(score, length+i, spec+(i*p->specificity), p->exten, '.', callerid, p->deleted, p);
+					update_scoreboard(score, length + i, spec + (i * p->specificity), p->exten, '.', callerid, p->deleted, p);
 					if (score->exten) {
 						ast_debug(4,"return because scoreboard has a match with '/'--- %s\n", score->exten->exten);
 						return; /* the first match is all we need */
 					}
 				}
 				if (p->next_char && p->next_char->x[0] == '/' && p->next_char->x[1] == 0) {
-					new_find_extension("/", score, p->next_char, length+i, spec+(p->specificity*i), callerid, label, action);
+					new_find_extension("/", score, p->next_char, length + i, spec+(p->specificity*i), callerid, label, action);
 					if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {
-						ast_debug(4,"return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set--- %s\n", score->exten ? score->exten->exten : "NULL");
+						ast_debug(4, "return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set--- %s\n", score->exten ? score->exten->exten : "NULL");
 						return; /* the first match is all we need */
 					}
 				}
@@ -1717,25 +1726,25 @@
 					i++;
 				}
 				if (p->exten && *str2 != '/') {
-					update_scoreboard(score, length+1, spec+(p->specificity*i), p->exten, '!', callerid, p->deleted, p);
+					update_scoreboard(score, length + 1, spec + (p->specificity * i), p->exten, '!', callerid, p->deleted, p);
 					if (score->exten) {
-						ast_debug(4,"return because scoreboard has a '!' match--- %s\n", score->exten->exten);
+						ast_debug(4, "return because scoreboard has a '!' match--- %s\n", score->exten->exten);
 						return; /* the first match is all we need */
 					}
 				}
 				if (p->next_char && p->next_char->x[0] == '/' && p->next_char->x[1] == 0) {
-					new_find_extension("/", score, p->next_char, length+i, spec+(p->specificity*i), callerid, label, action);
+					new_find_extension("/", score, p->next_char, length + i, spec + (p->specificity * i), callerid, label, action);
 					if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {
-						ast_debug(4,"return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/' and '!'--- %s\n", score->exten ? score->exten->exten : "NULL");
+						ast_debug(4, "return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/' and '!'--- %s\n", score->exten ? score->exten->exten : "NULL");
 						return; /* the first match is all we need */
 					}
 				}
 			} else if (p->x[0] == '/' && p->x[1] == 0) {
 				/* the pattern in the tree includes the cid match! */
 				if (p->next_char && callerid && *callerid) {
-					new_find_extension(callerid, score, p->next_char, length+1, spec, callerid, label, action);
+					new_find_extension(callerid, score, p->next_char, length + 1, spec, callerid, label, action);
 					if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {
-						ast_debug(4,"return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/'--- %s\n", score->exten ? score->exten->exten : "NULL");
+						ast_debug(4, "return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/'--- %s\n", score->exten ? score->exten->exten : "NULL");
 						return; /* the first match is all we need */
 					}
 				}
@@ -1750,7 +1759,7 @@
 			NEW_MATCHER_RECURSE;
 		}
 	}
-	ast_debug(4,"return at end of func\n");
+	ast_debug(4, "return at end of func\n");
 }
 
 /* the algorithm for forming the extension pattern tree is also a bit simple; you 
@@ -1808,7 +1817,7 @@
 	} 
 
 	lcurr = *parent_ptr;
-	for (curr=(*parent_ptr)->alt_char; curr; curr = curr->alt_char) {
+	for (curr = (*parent_ptr)->alt_char; curr; curr = curr->alt_char) {
 		if (curr->specificity > node->specificity) {
 			node->alt_char = curr;
 			lcurr->alt_char = node;




More information about the asterisk-commits mailing list