[asterisk-commits] junky: branch junky/cli-tls r212026 - /team/junky/cli-tls/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 13 05:56:34 CDT 2009


Author: junky
Date: Thu Aug 13 05:56:30 2009
New Revision: 212026

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=212026
Log:
fix many things based on the reviewboard:
-extra white spaces/tabs
-AST_LIST_TRAVERSE_SAFE_END; to outside block
-bad comments.



Modified:
    team/junky/cli-tls/main/logger.c
    team/junky/cli-tls/main/pbx.c

Modified: team/junky/cli-tls/main/logger.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/logger.c?view=diff&rev=212026&r1=212025&r2=212026
==============================================================================
--- team/junky/cli-tls/main/logger.c (original)
+++ team/junky/cli-tls/main/logger.c Thu Aug 13 05:56:30 2009
@@ -859,7 +859,6 @@
 		return NULL;
 	case CLI_GENERATE:
                 wordlen = strlen(a->word);
-                /* Since filter name are case sensitive, we use strcasecmp and not strncasecmp */ 
                 AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_cli_filters, filter, filter_list) {
                         if (!strncasecmp(a->word, filter->name, wordlen) && ++which > a->n) {
                                 ret = ast_strdup(filter->name);
@@ -879,10 +878,10 @@
 	if (!tmp) {
 		ast_cli(a->fd, "%s is not an active CLI filter\n", a->argv[3]);
 		return CLI_SUCCESS;
-	} 
+	}
 
 	if ( (count = ast_filter_remove(a->argv[3])) > 0) {
-		ast_cli(a->fd, "%s has been sucessfully removed from CLI filter list.\n", a->argv[3]);
+		ast_cli(a->fd, "%s have been sucessfully removed from CLI filter list.\n", a->argv[3]);
 	}
 
 	return CLI_SUCCESS;
@@ -908,7 +907,7 @@
         }
 
 	count = ast_filter_reset();
-	ast_cli(a->fd, "%d CLI filters has been sucessfully removed.\n", count);
+	ast_cli(a->fd, "%d CLI filters have been sucessfully removed.\n", count);
 		
         return CLI_SUCCESS;
 }
@@ -1112,18 +1111,16 @@
         }
 
 	if (ast_strlen_zero(name)) {
-		astman_send_error(s, m, "FilterAdd must provides a name.");
+		astman_send_error(s, m, "FilterAdd must provide a name.");
 		return -1;
 	}
 
 	if (ast_strlen_zero(type)) {
-		astman_send_error(s, m, "FilterAdd must provides a type.");
+		astman_send_error(s, m, "FilterAdd must provide a type.");
 		return -1;
 	}
 
-	count = ast_filter_add(type,name);
-
-	
+	count = ast_filter_add(type,name);	
         astman_append(s, "Response: Success\r\n%s", idText);
         return 0;
 }
@@ -1142,10 +1139,10 @@
         }
 
 	count = ast_filter_remove(name);
-	if ( count > 0 ) {
+	if (count > 0) {
 	        astman_append(s, "Response: Success\r\n%s", idText);
 	} else {
-		astman_send_error(s, m, "That filter doesnt exists.");	
+		astman_send_error(s, m, "That filter doesn't exist");	
 	}
         return 0;
 }
@@ -1182,7 +1179,7 @@
                 idText[0] = '\0';
         }
 
-	if (count > 0) {	
+	if (count > 0) {
 	        astman_append(s, "Response: Success\r\n%s", idText);
 	} else {
 		astman_send_error(s, m, "No filters are currently enabled.");  
@@ -1225,8 +1222,6 @@
         }
 
         ast_free(keyword);
-
-        /* TODO search it that filter already exists */
         AST_LIST_INSERT_HEAD(&ast_cli_filters, filter, filter_list);
 
 	return 1;
@@ -1236,15 +1231,15 @@
 
 static int ast_filter_reset() {
 	int count = 0;
-	struct ast_cli_filter *filter;	
+	struct ast_cli_filter *filter;
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_cli_filters, filter, filter_list) {
 		AST_LIST_REMOVE_CURRENT(filter_list);
 		ast_free(filter->name); /* since I ast_strdup it */
 		ast_free(filter);
 		count++;
-		AST_LIST_TRAVERSE_SAFE_END;
-	}
+	}
+	AST_LIST_TRAVERSE_SAFE_END;
 
 	return count;
 }
@@ -1256,13 +1251,13 @@
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_cli_filters, filter, filter_list) {
 		if (!strcmp(filter->name, name)) {
 			AST_LIST_REMOVE_CURRENT(filter_list);
-				count++;
-				ast_free(filter->name); /* since I ast_strdup it */
-				ast_free(filter);
-				break;
-			}
-			AST_LIST_TRAVERSE_SAFE_END;
-	}
+			count++;
+			ast_free(filter->name); /* since I ast_strdup it */
+			ast_free(filter);
+			break;
+		}
+	}
+	AST_LIST_TRAVERSE_SAFE_END;
 
 	return count;
 }
@@ -1730,20 +1725,18 @@
         int res = 0;
 
         if ((channels = ast_threadstorage_get(&filter_channels, sizeof(*channels)))) {
-                my_printf("Adding channel(%s) to channels_list\n", chan->name);
-                filter = ast_calloc(1, sizeof(*filter));
-                if (!filter) {
-                        ast_log(LOG_WARNING, "Out of memory\n");
-                        return -1;
-                }
-                filter->chan = ast_channel_ref(chan);
+		my_printf("Adding channel(%s) to channels_list\n", chan->name);
+		filter = ast_calloc(1, sizeof(*filter));
+		if (!filter) {
+			return -1;
+		}
+		filter->chan = ast_channel_ref(chan);
 		my_printf("TLS channel name is:%s\n", filter->chan->name);
-                AST_RWLIST_INSERT_HEAD(channels, filter, next);
+		AST_LIST_INSERT_HEAD(channels, filter, next);
         } else {
-                ast_log(LOG_WARNING, "Out of memory\n");
-                res = -1;
-        }
-        return res;
+		res = -1;
+	}
+	return res;
 }
 
 /* Function used to remove a specific channel from the TLS container 
@@ -1760,7 +1753,7 @@
 	AST_LIST_TRAVERSE_SAFE_BEGIN(channels, filter, next) {
 		if (!strcmp(filter->chan->name, chan->name)) {
 			AST_LIST_REMOVE_CURRENT(next);
-			ast_log(LOG_WARNING, "%s has been sucessfully removed from CLI filter list.\n", chan->name);
+			ast_log(LOG_WARNING, "%s have been sucessfully removed from CLI filter list.\n", chan->name);
 			ast_channel_unref(chan);
 			ast_free(filter);
 			res=1;
@@ -1826,16 +1819,16 @@
 						comparee = ast_strdup(c->name);
 					}
 
-                                        my_printf("filter name=[%s] type=[%d] comparator=[%s] comparee=[%s]\n",c->name, c->type, comparator, comparee);
+					my_printf("filter name=[%s] type=[%d] comparator=[%s] comparee=[%s]\n",c->name, c->type, comparator, comparee);
 
 					if (strncmp(comparator, comparee, strlen(comparee))) {
-                                                my_printf("Ignore %s, since this is not in filter list\n", filter->chan->name);
-						res=1;
-                                        } else {
-                                                my_printf("%s match my filter, so continue\n", filter->chan->name);
-                                                res=0;
-                                                break;
-                                        }
+						my_printf("Ignore %s, since this is not in filter list\n", filter->chan->name);
+						res = 1;
+					} else {
+						my_printf("%s match my filter, so continue\n", filter->chan->name);
+						res = 0;
+						break;
+					}
 					ast_free(comparator);
 					ast_free(comparee);
                                 }
@@ -1845,7 +1838,7 @@
 
         } else {
 		printf("chan NOT THERE\n");
-	} 
+	}
 
 	my_printf("I return %d\n",res);
 	return res;
@@ -1869,7 +1862,7 @@
 static void __attribute__((format(printf, 1,2))) my_printf(const char *fmt, ...) {
 #ifdef PRINTF_DEBUG
 	va_list ap;
-	char *buf;	
+	char *buf;
 
 	va_start(ap, fmt);
         if (ast_vasprintf(&buf, fmt, ap) < 0) {

Modified: team/junky/cli-tls/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/junky/cli-tls/main/pbx.c?view=diff&rev=212026&r1=212025&r2=212026
==============================================================================
--- team/junky/cli-tls/main/pbx.c (original)
+++ team/junky/cli-tls/main/pbx.c Thu Aug 13 05:56:30 2009
@@ -4064,7 +4064,7 @@
 			ast_debug(1, "Launching '%s'\n", app->name);
 			if (VERBOSITY_ATLEAST(3)) {
 				char tmp[80], tmp2[80], tmp3[EXT_DATA_SIZE];
-				ast_verb(3, "2Executing [%s@%s:%d] %s(\"%s\", \"%s\") %s\n",
+				ast_verb(3, "Executing [%s@%s:%d] %s(\"%s\", \"%s\") %s\n",
 					exten, context, priority,
 					term_color(tmp, app->name, COLOR_BRCYAN, 0, sizeof(tmp)),
 					term_color(tmp2, c->name, COLOR_BRMAGENTA, 0, sizeof(tmp2)),




More information about the asterisk-commits mailing list