[asterisk-commits] rizzo: trunk r47186 - /trunk/main/logger.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 3 18:35:00 MST 2006


Author: rizzo
Date: Fri Nov  3 19:34:59 2006
New Revision: 47186

URL: http://svn.digium.com/view/asterisk?rev=47186&view=rev
Log:
remove many unnecessary casts


Modified:
    trunk/main/logger.c

Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?rev=47186&r1=47185&r2=47186&view=diff
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Fri Nov  3 19:34:59 2006
@@ -269,9 +269,9 @@
 		}		  
 		
 		if(!ast_strlen_zero(hostname)) {
-			snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",(char *)ast_config_AST_LOG_DIR, channel, hostname);
+			snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s", ast_config_AST_LOG_DIR, channel, hostname);
 		} else {
-			snprintf(chan->filename, sizeof(chan->filename), "%s/%s", (char *)ast_config_AST_LOG_DIR, channel);
+			snprintf(chan->filename, sizeof(chan->filename), "%s/%s", ast_config_AST_LOG_DIR, channel);
 		}
 		chan->fileptr = fopen(chan->filename, "a");
 		if (!chan->fileptr) {
@@ -395,7 +395,7 @@
 		queue_rotate = 0;
 	qlog = NULL;
 
-	mkdir((char *)ast_config_AST_LOG_DIR, 0755);
+	mkdir(ast_config_AST_LOG_DIR, 0755);
 
 	AST_LIST_TRAVERSE(&logchannels, f, list) {
 		if (f->disabled) {
@@ -411,7 +411,7 @@
 				if (!rotatetimestamp) { 
 					for (x = 0; ; x++) {
 						snprintf(new, sizeof(new), "%s.%d", f->filename, x);
-						myf = fopen((char *)new, "r");
+						myf = fopen(new, "r");
 						if (myf)
 							fclose(myf);
 						else
@@ -432,19 +432,19 @@
 	init_logger_chain();
 
 	if (logfiles.event_log) {
-		snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
+		snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
 		if (event_rotate) {
 			if (!rotatetimestamp) { 
 				for (x=0;;x++) {
-					snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, EVENTLOG,x);
-					myf = fopen((char *)new, "r");
+					snprintf(new, sizeof(new), "%s/%s.%d", ast_config_AST_LOG_DIR, EVENTLOG,x);
+					myf = fopen(new, "r");
 					if (myf) 	/* File exists */
 						fclose(myf);
 					else
 						break;
 				}
 			} else 
-				snprintf(new, sizeof(new), "%s/%s.%ld", (char *)ast_config_AST_LOG_DIR, EVENTLOG,(long)time(NULL));
+				snprintf(new, sizeof(new), "%s/%s.%ld", ast_config_AST_LOG_DIR, EVENTLOG,(long)time(NULL));
 	
 			/* do it */
 			if (rename(old,new))
@@ -463,12 +463,12 @@
 	}
 
 	if (logfiles.queue_log) {
-		snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, queue_log_name);
+		snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
 		if (queue_rotate) {
 			if (!rotatetimestamp) { 
 				for (x = 0; ; x++) {
-					snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, queue_log_name, x);
-					myf = fopen((char *)new, "r");
+					snprintf(new, sizeof(new), "%s/%s.%d", ast_config_AST_LOG_DIR, queue_log_name, x);
+					myf = fopen(new, "r");
 					if (myf) 	/* File exists */
 						fclose(myf);
 					else
@@ -476,7 +476,7 @@
 				}
 	
 			} else 
-				snprintf(new, sizeof(new), "%s/%s.%ld", (char *)ast_config_AST_LOG_DIR, queue_log_name,(long)time(NULL));
+				snprintf(new, sizeof(new), "%s/%s.%ld", ast_config_AST_LOG_DIR, queue_log_name,(long)time(NULL));
 			/* do it */
 			if (rename(old, new))
 				ast_log(LOG_ERROR, "Unable to rename file '%s' to '%s'\n", old, new);
@@ -605,20 +605,20 @@
 	/* register the logger cli commands */
 	ast_cli_register_multiple(cli_logger, sizeof(cli_logger) / sizeof(struct ast_cli_entry));
 
-	mkdir((char *)ast_config_AST_LOG_DIR, 0755);
+	mkdir(ast_config_AST_LOG_DIR, 0755);
   
 	/* create log channels */
 	init_logger_chain();
 
 	/* create the eventlog */
 	if (logfiles.event_log) {
-		mkdir((char *)ast_config_AST_LOG_DIR, 0755);
-		snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
-		eventlog = fopen((char *)tmp, "a");
+		mkdir(ast_config_AST_LOG_DIR, 0755);
+		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
+		eventlog = fopen(tmp, "a");
 		if (eventlog) {
 			ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
 			if (option_verbose)
-				ast_verbose("Asterisk Event Logger Started %s\n",(char *)tmp);
+				ast_verbose("Asterisk Event Logger Started %s\n", tmp);
 		} else {
 			ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
 			res = -1;
@@ -626,7 +626,7 @@
 	}
 
 	if (logfiles.queue_log) {
-		snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, queue_log_name);
+		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
 		qlog = fopen(tmp, "a");
 		ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", "");
 	}



More information about the asterisk-commits mailing list