[asterisk-commits] anthonyl: branch anthonyl/escape-filter2 r47298 - in /team/anthonyl/escape-fi...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 7 16:09:01 MST 2006


Author: anthonyl
Date: Tue Nov  7 17:09:00 2006
New Revision: 47298

URL: http://svn.digium.com/view/asterisk?rev=47298&view=rev
Log:
updates based on mogs input

Modified:
    team/anthonyl/escape-filter2/include/asterisk/utils.h
    team/anthonyl/escape-filter2/main/logger.c
    team/anthonyl/escape-filter2/main/utils.c

Modified: team/anthonyl/escape-filter2/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/anthonyl/escape-filter2/include/asterisk/utils.h?rev=47298&r1=47297&r2=47298&view=diff
==============================================================================
--- team/anthonyl/escape-filter2/include/asterisk/utils.h (original)
+++ team/anthonyl/escape-filter2/include/asterisk/utils.h Tue Nov  7 17:09:00 2006
@@ -529,5 +529,5 @@
   to ensure that the DF bit will not be set.
  */
 void ast_enable_packet_fragmentation(int sock);
-void ast_filter_escapes(const char *line, char *p);
+char *ast_filter_escapes(const char *line);
 #endif /* _ASTERISK_UTILS_H */

Modified: team/anthonyl/escape-filter2/main/logger.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/escape-filter2/main/logger.c?rev=47298&r1=47297&r2=47298&view=diff
==============================================================================
--- team/anthonyl/escape-filter2/main/logger.c (original)
+++ team/anthonyl/escape-filter2/main/logger.c Tue Nov  7 17:09:00 2006
@@ -683,7 +683,6 @@
        	time_t t;
 	struct tm tm;
 	char date[256];
-	char *p = NULL;
 	
 	va_list ap;
 
@@ -701,10 +700,9 @@
 			va_start(ap, fmt);
 			res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap);
 			va_end(ap);
-			if (res != AST_DYNSTR_BUILD_FAILED) {
-				printf("--------------------\n"); /* filter point 1 */
+			if (res != AST_DYNSTR_BUILD_FAILED)
 				fputs(buf->str, stdout);
-			}
+			
 		}
 		return;
 	}
@@ -850,8 +848,8 @@
 {
 	struct verb *v;
 	struct ast_dynamic_str *buf;
+	char *p;
 	int res;
-	char *p = NULL;
 	va_list ap;
 	
 	if (ast_opt_timestamp) {
@@ -877,12 +875,11 @@
 
 	if (res == AST_DYNSTR_BUILD_FAILED)
 		return;
-	p = ast_calloc(1,strlen(buf->str));
-	
+
+	p = ast_filter_escapes(buf->str);
+
 	if (!p)
 		return;
-	memset(p,'\0',strlen(buf->str));
-	ast_filter_escapes(buf->str,p);
 	
 	AST_LIST_LOCK(&verbosers);
 	AST_LIST_TRAVERSE(&verbosers, v, list)

Modified: team/anthonyl/escape-filter2/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/escape-filter2/main/utils.c?rev=47298&r1=47297&r2=47298&view=diff
==============================================================================
--- team/anthonyl/escape-filter2/main/utils.c (original)
+++ team/anthonyl/escape-filter2/main/utils.c Tue Nov  7 17:09:00 2006
@@ -998,11 +998,17 @@
 
 
 /* make output a tad more sane */
-void ast_filter_escapes(const char *line, char *p)
+char* ast_filter_escapes(const char *line)
  {
 	 int i  = 0;
 	 int ii = 0;
 	 int tamper = 0;
+	 char *p;
+
+	 p = ast_calloc(1,strlen(line));
+
+	 if (!p)
+		 return NULL;
 	 
 	 for (i=0;i<strlen(line);i++) {
 		 if (line[i] == '\x1B') {					 
@@ -1018,9 +1024,9 @@
 		 p[ii] = line[i];
 		 ii++;
 	 }
-
+ 
 	 if (tamper == 1) 
-		 snprintf(p,strlen(line),"\0");
+		 p[0] = '\0';
 	 
-	 return;
+	 return p;
  }



More information about the asterisk-commits mailing list