[asterisk-commits] mmichelson: branch mmichelson/npm_fixes r181021 - /team/mmichelson/npm_fixes/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 10 18:31:02 CDT 2009
Author: mmichelson
Date: Tue Mar 10 18:30:59 2009
New Revision: 181021
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181021
Log:
Fix coding guidelines violations that were annoying me.
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=181021&r1=181020&r2=181021
==============================================================================
--- team/mmichelson/npm_fixes/main/pbx.c (original)
+++ team/mmichelson/npm_fixes/main/pbx.c Tue Mar 10 18:30:59 2009
@@ -1875,7 +1875,6 @@
char extenbuf[512];
char *s1 = extenbuf;
int l1 = strlen(e1->exten) + strlen(e1->cidmatch) + 2;
-
ast_copy_string(extenbuf, e1->exten, sizeof(extenbuf));
@@ -1897,33 +1896,33 @@
pattern = 1;
s1++;
}
- while( *s1 ) {
- if (pattern && *s1 == '[' && *(s1-1) != '\\') {
+ while (*s1) {
+ if (pattern && *s1 == '[' && *(s1 - 1) != '\\') {
char *s2 = buf;
buf[0] = 0;
s1++; /* get past the '[' */
- while (*s1 != ']' && *(s1-1) != '\\' ) {
+ while (*s1 != ']' && *(s1 - 1) != '\\') {
if (*s1 == '\\') {
- if (*(s1+1) == ']') {
+ if (*(s1 + 1) == ']') {
*s2++ = ']';
- s1++;s1++;
+ s1 += 2;
} else if (*(s1+1) == '\\') {
*s2++ = '\\';
- s1++;s1++;
+ s1 += 2;
} else if (*(s1+1) == '-') {
*s2++ = '-';
- s1++; s1++;
+ s1 += 2;
} else if (*(s1+1) == '[') {
*s2++ = '[';
- s1++; s1++;
+ s1 += 2;
}
} else if (*s1 == '-') { /* remember to add some error checking to all this! */
- char s3 = *(s1-1);
- char s4 = *(s1+1);
+ char s3 = *(s1 - 1);
+ char s4 = *(s1 + 1);
for (s3++; s3 <= s4; s3++) {
*s2++ = s3;
}
- s1++; s1++;
+ s1 += 2;
} else if (*s1 == '\0') {
ast_log(LOG_WARNING, "A matching ']' was not found for '[' in pattern string '%s'\n", extenbuf);
break;
@@ -1939,18 +1938,18 @@
specif <<= 8;
specif += buf[0];
} else {
-
if (*s1 == '\\') {
s1++;
buf[0] = *s1;
} else {
if (pattern) {
- if (*s1 == 'n') /* make sure n,x,z patterns are canonicalized to N,X,Z */
+ if (*s1 == 'n') { /* make sure n,x,z patterns are canonicalized to N,X,Z */
*s1 = 'N';
- else if (*s1 == 'x')
+ } else if (*s1 == 'x') {
*s1 = 'X';
- else if (*s1 == 'z')
+ } else if (*s1 == 'z') {
*s1 = 'Z';
+ }
}
buf[0] = *s1;
}
@@ -1958,8 +1957,8 @@
specif = 1;
}
m2 = 0;
- if (already && (m2=already_in_tree(m1,buf,pattern)) && m2->next_char) {
- if (!(*(s1+1))) { /* if this is the end of the pattern, but not the end of the tree, then mark this node with the exten...
+ if (already && (m2 = already_in_tree(m1, buf, pattern)) && m2->next_char) {
+ if (!(*(s1 + 1))) { /* if this is the end of the pattern, but not the end of the tree, then mark this node with the exten...
a shorter pattern might win if the longer one doesn't match */
if (m2->exten) {
ast_log(LOG_WARNING, "Found duplicate exten. Had %s found %s\n", m2->exten->exten, e1->exten);
@@ -1971,18 +1970,20 @@
m0 = &m2->next_char; /* m0 points to the ptr that points to m1 */
} else { /* not already OR not m2 OR nor m2->next_char */
if (m2) {
- if (findonly)
+ if (findonly) {
return m2;
+ }
m1 = m2; /* while m0 stays the same */
} else {
- if (findonly)
+ if (findonly) {
return m1;
+ }
if (!(m1 = add_pattern_node(con, m1, buf, pattern, already,specif, m0))) { /* m1 is the node just added */
return NULL;
}
m0 = &m1->next_char;
}
- if (!(*(s1+1))) {
+ if (!(*(s1 + 1))) {
if (m2) {
ast_log(LOG_WARNING, "Found duplicate exten. Had %s found %s\n", m2->exten->exten, e1->exten);
}
More information about the asterisk-commits
mailing list