[asterisk-commits] rmudgett: branch rmudgett/ast_verb r405251 - /team/rmudgett/ast_verb/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 9 12:03:25 CST 2014


Author: rmudgett
Date: Thu Jan  9 12:03:20 2014
New Revision: 405251

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405251
Log:
Fix an inconsistency in the usage of make_components().

Modified:
    team/rmudgett/ast_verb/main/logger.c

Modified: team/rmudgett/ast_verb/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ast_verb/main/logger.c?view=diff&rev=405251&r1=405250&r2=405251
==============================================================================
--- team/rmudgett/ast_verb/main/logger.c (original)
+++ team/rmudgett/ast_verb/main/logger.c Thu Jan  9 12:03:20 2014
@@ -237,11 +237,11 @@
 
 static void logger_queue_init(void);
 
-static unsigned int make_components(const char *s, int lineno, int *verbosity)
+static void make_components(struct logchannel *chan)
 {
 	char *w;
-	unsigned int res = 0;
-	char *stringp = ast_strdupa(s);
+	unsigned int logmask = 0;
+	char *stringp = ast_strdupa(chan->components);
 	unsigned int x;
 	int verb_level;
 
@@ -254,23 +254,31 @@
 			continue;
 		}
 		if (!strcmp(w, "*")) {
-			res = 0xFFFFFFFF;
+			logmask = 0xFFFFFFFF;
 		} else if (!strncasecmp(w, "verbose(", 8)) {
 			if (levels[__LOG_VERBOSE] && sscanf(w + 8, "%30u)", &verb_level) == 1) {
-				res |= (1 << __LOG_VERBOSE);
+				logmask |= (1 << __LOG_VERBOSE);
 			}
 		} else {
-			for (x = 0; x < ARRAY_LEN(levels); x++) {
+			for (x = 0; x < ARRAY_LEN(levels); ++x) {
 				if (levels[x] && !strcasecmp(w, levels[x])) {
-					res |= (1 << x);
+					logmask |= (1 << x);
 					break;
 				}
 			}
 		}
 	}
-	*verbosity = verb_level;
-
-	return res;
+	if (chan->type == LOGTYPE_CONSOLE) {
+		/*
+		 * Force to use the root console verbose level so if the
+		 * user specified any verbose level then it does not interfere
+		 * with calculating the ast_verb_sys_level value.
+		 */
+		chan->verbosity = -1;
+	} else {
+		chan->verbosity = verb_level;
+	}
+	chan->logmask = logmask;
 }
 
 static struct logchannel *make_logchannel(const char *channel, const char *components, int lineno)
@@ -340,15 +348,7 @@
 		}
 		chan->type = LOGTYPE_FILE;
 	}
-	chan->logmask = make_components(chan->components, lineno, &chan->verbosity);
-	if (chan->type == LOGTYPE_CONSOLE) {
-		/*
-		 * Force to use the root console verbose level so if the
-		 * user specified any verbose level then it does not interfere
-		 * with calculating the ast_verb_sys_level value.
-		 */
-		chan->verbosity = -1;
-	}
+	make_components(chan);
 	return chan;
 }
 
@@ -2084,7 +2084,7 @@
 	global_logmask = 0;
 
 	AST_RWLIST_TRAVERSE(&logchannels, cur, list) {
-		cur->logmask = make_components(cur->components, cur->lineno, &cur->verbosity);
+		make_components(cur);
 		global_logmask |= cur->logmask;
 	}
 




More information about the asterisk-commits mailing list