[svn-commits] file: trunk r103318 - /trunk/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 11 12:27:49 CST 2008


Author: file
Date: Mon Feb 11 12:27:47 2008
New Revision: 103318

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103318
Log:
Just some minor coding style cleanup...

Modified:
    trunk/main/app.c
    trunk/main/asterisk.c
    trunk/main/indications.c
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/main/rtp.c
    trunk/main/translate.c
    trunk/main/utils.c

Modified: trunk/main/app.c
URL: http://svn.digium.com/view/asterisk/trunk/main/app.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Mon Feb 11 12:27:47 2008
@@ -1458,7 +1458,7 @@
 
 static int read_newoption(struct ast_channel *chan, struct ast_ivr_menu *menu, char *exten, int maxexten)
 {
-	int res=0;
+	int res = 0;
 	int ms;
 	while (option_matchmore(menu, exten)) {
 		ms = chan->pbx ? chan->pbx->dtimeout : 5000;
@@ -1476,7 +1476,7 @@
 static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_menu *menu, void *cbdata)
 {
 	/* Execute an IVR menu structure */
-	int res=0;
+	int res = 0;
 	int pos = 0;
 	int retries = 0;
 	char exten[AST_MAX_EXTENSION] = "s";

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Feb 11 12:27:47 2008
@@ -947,7 +947,7 @@
 static void ast_network_puts(const char *string)
 {
 	int x;
-	for (x=0; x < AST_MAX_CONNECTS; x++) {
+	for (x = 0; x < AST_MAX_CONNECTS; x++) {
 		if (consoles[x].fd > -1) 
 			fdprint(consoles[x].p[1], string);
 	}
@@ -1905,7 +1905,7 @@
 					int tries;
 					int reconnects_per_second = 20;
 					fprintf(stderr, "Attempting to reconnect for 30 seconds\n");
-					for (tries=0; tries < 30 * reconnects_per_second; tries++) {
+					for (tries = 0; tries < 30 * reconnects_per_second; tries++) {
 						if (ast_tryconnect()) {
 							fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries);
 							printf(term_quit());
@@ -2152,7 +2152,7 @@
 
 	for (; count > 0; count--) {
 		numoutputline = 0;
-		for (i=0; i < limit && matches[idx]; i++, idx++) {
+		for (i = 0; i < limit && matches[idx]; i++, idx++) {
 
 			/* Don't print dupes */
 			if ( (matches[idx+1] != NULL && strcmp(matches[idx], matches[idx+1]) == 0 ) ) {
@@ -2264,7 +2264,7 @@
 			retval = CC_REFRESH;
 		} else {
 			/* Must be more than one match */
-			for (i=1, maxlen=0; matches[i]; i++) {
+			for (i = 1, maxlen = 0; matches[i]; i++) {
 				match_len = strlen(matches[i]);
 				if (match_len > maxlen)
 					maxlen = match_len;
@@ -2792,7 +2792,7 @@
 		fprintf(stderr, "Truncating argument size to %d\n", (int)(sizeof(_argv) / sizeof(_argv[0])) - 1);
 		argc = sizeof(_argv) / sizeof(_argv[0]) - 1;
 	}
-	for (x=0; x<argc; x++)
+	for (x = 0; x < argc; x++)
 		_argv[x] = argv[x];
 	_argv[x] = NULL;
 

Modified: trunk/main/indications.c
URL: http://svn.digium.com/view/asterisk/trunk/main/indications.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/indications.c (original)
+++ trunk/main/indications.c Mon Feb 11 12:27:47 2008
@@ -165,7 +165,7 @@
 		ps->v3_2 = pi->init_v3_2;
 		ps->oldnpos = ps->npos;
 	}
-	for (x=0;x<len/2;x++) {
+	for (x = 0; x < len/2; x++) {
 		ps->v1_1 = ps->v2_1;
 		ps->v2_1 = ps->v3_1;
 		ps->v3_1 = (pi->fac1 * ps->v2_1 >> 15) - ps->v1_1;
@@ -233,7 +233,7 @@
 		separator = ",";
 	s = strsep(&stringp,separator);
 	while (s && *s) {
-		int freq1, freq2, time, modulate=0, midinote=0;
+		int freq1, freq2, time, modulate = 0, midinote = 0;
 
 		if (s[0]=='!')
 			s++;
@@ -533,7 +533,7 @@
 
 	AST_RWLIST_WRLOCK(&tone_zones);
 	for (ps=NULL,ts=zone->tones; ts; ps=ts,ts=ts->next) {
-		if (strcasecmp(indication,ts->name)==0) {
+		if (!strcasecmp(indication,ts->name)) {
 			/* indication already there, replace */
 			ast_free((void*)ts->name);
 			ast_free((void*)ts->data);
@@ -573,7 +573,7 @@
 	AST_RWLIST_WRLOCK(&tone_zones);
 	ts = zone->tones;
 	while (ts) {
-		if (strcasecmp(indication,ts->name)==0) {
+		if (!strcasecmp(indication,ts->name)) {
 			/* indication found */
 			tmp = ts->next;
 			if (ps)

Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Mon Feb 11 12:27:47 2008
@@ -1081,7 +1081,7 @@
 void ast_backtrace(void)
 {
 #ifdef HAVE_BKTR
-	int count=0, i=0;
+	int count = 0, i = 0;
 	void **addresses;
 	char **strings;
 
@@ -1089,7 +1089,7 @@
 		count = backtrace(addresses, MAX_BACKTRACE_FRAMES);
 		if ((strings = backtrace_symbols(addresses, count))) {
 			ast_debug(1, "Got %d backtrace record%c\n", count, count != 1 ? 's' : ' ');
-			for (i=0; i < count ; i++) {
+			for (i = 0; i < count; i++) {
 #if __WORDSIZE == 32
 				ast_log(LOG_DEBUG, "#%d: [%08X] %s\n", i, (unsigned int)addresses[i], strings[i]);
 #elif __WORDSIZE == 64

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Mon Feb 11 12:27:47 2008
@@ -395,7 +395,7 @@
 		return 0;
 	if (ast_true(string)) {	/* all permissions */
 		int x, ret = 0;
-		for (x=0; x<sizeof(perms) / sizeof(perms[0]); x++)
+		for (x = 0; x<sizeof(perms) / sizeof(perms[0]); x++)
 			ret |= perms[x].num;
 		return ret;
 	}
@@ -1009,7 +1009,7 @@
 			MD5Update(&md5, (unsigned char *) s->challenge, strlen(s->challenge));
 			MD5Update(&md5, (unsigned char *) user->secret, strlen(user->secret));
 			MD5Final(digest, &md5);
-			for (x=0; x<16; x++)
+			for (x = 0; x < 16; x++)
 				len += sprintf(md5key + len, "%2.2x", digest[x]);
 			if (!strcmp(md5key, key))
 				error = 0;
@@ -1334,7 +1334,7 @@
 	s->waiting_thread = pthread_self();	/* let new events wake up this thread */
 	ast_debug(1, "Starting waiting for an event!\n");
 
-	for (x=0; x < timeout || timeout < 0; x++) {
+	for (x = 0; x < timeout || timeout < 0; x++) {
 		ast_mutex_lock(&s->__lock);
 		if (NEW_EVENT(s))
 			needexit = 1;

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Mon Feb 11 12:27:47 2008
@@ -1127,7 +1127,7 @@
 
 static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, struct ast_exten *e1, int findonly)
 {
-	struct match_char *m1=0,*m2=0;
+	struct match_char *m1 = NULL, *m2 = NULL;
 	int specif;
 	int already;
 	int pattern = 0;
@@ -1453,7 +1453,7 @@
 {
 	mode &= E_MATCH_MASK;	/* only consider the relevant bits */
 
-	if ( (mode == E_MATCH) && (pattern[0] == '_') && (strcasecmp(pattern,data)==0) ) /* note: if this test is left out, then _x. will not match _x. !!! */
+	if ( (mode == E_MATCH) && (pattern[0] == '_') && (!strcasecmp(pattern,data)) ) /* note: if this test is left out, then _x. will not match _x. !!! */
 		return 1;
 
 	if (pattern[0] != '_') { /* not a pattern, try exact or partial match */
@@ -1628,12 +1628,12 @@
 	const char *label, const char *callerid, enum ext_match_t action)
 {
 	int x, res;
-	struct ast_context *tmp=0;
-	struct ast_exten *e=0, *eroot=0;
-	struct ast_include *i = 0;
-	struct ast_sw *sw = 0;
-	struct ast_exten pattern = {0};
-	struct scoreboard score = {0};
+	struct ast_context *tmp = NULL;
+	struct ast_exten *e = NULL, *eroot = NULL;
+	struct ast_include *i = NULL;
+	struct ast_sw *sw = NULL;
+	struct ast_exten pattern = {NULL, };
+	struct scoreboard score = {0, };
 
 	pattern.label = label;
 	pattern.priority = priority;
@@ -1870,7 +1870,7 @@
  */
 static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
 {
-	int parens=0;
+	int parens = 0;
 
 	*offset = 0;
 	*length = INT_MAX;
@@ -2034,7 +2034,7 @@
 		if (places[i] == &globals)
 			ast_rwlock_rdlock(&globalslock);
 		AST_LIST_TRAVERSE(places[i], variables, entries) {
-			if (strcasecmp(ast_var_name(variables), var)==0) {
+			if (!strcasecmp(ast_var_name(variables), var)) {
 				s = ast_var_value(variables);
 				break;
 			}
@@ -4568,9 +4568,9 @@
 				if (includecount >= AST_PBX_MAX_STACK) {
 					ast_log(LOG_NOTICE, "Maximum include depth exceeded!\n");
 				} else {
-					int dupe=0;
+					int dupe = 0;
 					int x;
-					for (x=0;x<includecount;x++) {
+					for (x = 0; x < includecount; x++) {
 						if (!strcasecmp(includes[x], ast_get_include_name(i))) {
 							dupe++;
 							break;
@@ -4719,7 +4719,7 @@
 					struct ast_include *rinclude)
 {
 	struct ast_context *c;
-	int res=0, old_total_exten = dpc->total_exten;
+	int res = 0, old_total_exten = dpc->total_exten;
 
 	if (ast_strlen_zero(exten))
 		exten = NULL;
@@ -5407,7 +5407,7 @@
 	/* 2-minutes per bit, since the mask has only 32 bits :( */
 	/* Star is all times */
 	if (ast_strlen_zero(times) || !strcmp(times, "*")) {
-		for (x=0; x<24; x++)
+		for (x = 0; x < 24; x++)
 			i->minmask[x] = 0x3fffffff; /* 30 bits */
 		return;
 	}
@@ -5452,10 +5452,10 @@
 	/* Do the last one */
 	i->minmask[x/30] |= (1 << (x % 30));
 #else
-	for (cth=0; cth<24; cth++) {
+	for (cth = 0; cth < 24; cth++) {
 		/* Initialize masks to blank */
 		i->minmask[cth] = 0;
-		for (ctm=0; ctm<30; ctm++) {
+		for (ctm = 0; ctm < 30; ctm++) {
 			if (
 			/* First hour with more than one hour */
 			      (((cth == s1) && (ctm >= s2)) &&
@@ -5931,7 +5931,7 @@
 /*! \brief copy a string skipping whitespace */
 static int ext_strncpy(char *dst, const char *src, int len)
 {
-	int count=0;
+	int count = 0;
 
 	while (*src && (count < len - 1)) {
 		switch (*src) {
@@ -6903,7 +6903,7 @@
  */
 static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data)
 {
-	int res=0;
+	int res = 0;
 	char *s, *ts;
 	struct ast_timing timing;
 
@@ -7527,7 +7527,7 @@
 	__ast_custom_function_register(&exception_function, NULL);
 
 	/* Register builtin applications */
-	for (x=0; x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
+	for (x = 0; x < sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
 		ast_verb(1, "[%s]\n", builtins[x].name);
 		if (ast_register_application2(builtins[x].name, builtins[x].execute, builtins[x].synopsis, builtins[x].description, NULL)) {
 			ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Mon Feb 11 12:27:47 2008
@@ -1542,7 +1542,7 @@
 
 	rtp->lastrxseqno = seqno;
 	
-	if (rtp->themssrc==0)
+	if (!rtp->themssrc)
 		rtp->themssrc = ntohl(rtpheader[2]); /* Record their SSRC to put in future RR */
 	
 	if (rtp_debug_test_addr(&sin))
@@ -1767,7 +1767,7 @@
 	rtp_bridge_lock(dest);
 	rtp_bridge_lock(src);
 
-	for (i=0; i < MAX_RTP_PT; ++i) {
+	for (i = 0; i < MAX_RTP_PT; ++i) {
 		dest->current_RTP_PT[i].isAstFormat = 
 			src->current_RTP_PT[i].isAstFormat;
 		dest->current_RTP_PT[i].code = 

Modified: trunk/main/translate.c
URL: http://svn.digium.com/view/asterisk/trunk/main/translate.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/translate.c (original)
+++ trunk/main/translate.c Mon Feb 11 12:27:47 2008
@@ -482,11 +482,11 @@
 	for (;;) {
 		int changed = 0;
 		for (x = 0; x < MAX_FORMAT; x++) {      /* source format */
-			for (y=0; y < MAX_FORMAT; y++) {    /* intermediate format */
+			for (y = 0; y < MAX_FORMAT; y++) {    /* intermediate format */
 				if (x == y)                     /* skip ourselves */
 					continue;
 
-				for (z=0; z<MAX_FORMAT; z++) {  /* dst format */
+				for (z = 0; z<MAX_FORMAT; z++) {  /* dst format */
 					int newcost;
 
 					if (z == x || z == y)       /* skip null conversions */

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?view=diff&rev=103318&r1=103317&r2=103318
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Mon Feb 11 12:27:47 2008
@@ -92,8 +92,8 @@
 	} else {
 		char **p, **q;
 		char *pbuf;
-		int nbytes=0;
-		int naddr=0, naliases=0;
+		int nbytes = 0;
+		int naddr = 0, naliases = 0;
 		/* determine if we have enough space in buf */
 
 		/* count how many addresses */
@@ -180,7 +180,7 @@
 {
 	int res;
 	int herrno;
-	int dots=0;
+	int dots = 0;
 	const char *s;
 	struct hostent *result = NULL;
 	/* Although it is perfectly legitimate to lookup a pure integer, for




More information about the svn-commits mailing list