[asterisk-commits] rizzo: trunk r44616 - /trunk/main/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Oct 6 13:16:14 MST 2006


Author: rizzo
Date: Fri Oct  6 15:16:13 2006
New Revision: 44616

URL: http://svn.digium.com/view/asterisk?rev=44616&view=rev
Log:
simplify logic in preparation to reduce indentation


Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?rev=44616&r1=44615&r2=44616&view=diff
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Fri Oct  6 15:16:13 2006
@@ -862,11 +862,13 @@
 	cfg = ast_config_load("manager.conf");
 	if (!cfg)
 		return -1;
-	cat = ast_category_browse(cfg, NULL);
-	while (cat) {
-		if (strcasecmp(cat, "general")) {
-			/* This is a user */
-			if (!strcasecmp(cat, user)) {
+	cat = NULL;
+	while ( (cat = ast_category_browse(cfg, cat)) ) {
+		if (!strcasecmp(cat, "general") || strcasecmp(cat, user))
+			continue;	/* skip 'general' and non-matching sections */
+
+		/* XXX fix indentation */
+		{
 				struct ast_variable *v;
 				struct ast_ha *ha = NULL;
 				char *password = NULL;
@@ -929,9 +931,7 @@
 					ast_config_destroy(cfg);
 					return -1;
 				}	
-			}
-		}
-		cat = ast_category_browse(cfg, cat);
+		}
 	}
 	if (cat) {
 		ast_copy_string(s->username, cat, sizeof(s->username));



More information about the asterisk-commits mailing list