[asterisk-commits] jpeeler: branch jpeeler/manager-configactions r103328 - in /team/jpeeler/mana...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 11 17:38:59 CST 2008
Author: jpeeler
Date: Mon Feb 11 17:38:59 2008
New Revision: 103328
URL: http://svn.digium.com/view/asterisk?view=rev&rev=103328
Log:
added some comments and fixed some formatting
Modified:
team/jpeeler/manager-configactions/include/asterisk/config.h
team/jpeeler/manager-configactions/main/config.c
team/jpeeler/manager-configactions/main/manager.c
Modified: team/jpeeler/manager-configactions/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/jpeeler/manager-configactions/include/asterisk/config.h?view=diff&rev=103328&r1=103327&r2=103328
==============================================================================
--- team/jpeeler/manager-configactions/include/asterisk/config.h (original)
+++ team/jpeeler/manager-configactions/include/asterisk/config.h Mon Feb 11 17:38:59 2008
@@ -254,6 +254,15 @@
struct ast_category *ast_category_new(const char *name, const char *in_file, int lineno);
void ast_category_append(struct ast_config *config, struct ast_category *cat);
+
+/*!
+ * \brief Inserts new category
+ * \param config which config to use
+ * \param cat newly created category to insert
+ * \param match which category to insert above
+ * This function is used to insert a new category above another category
+ * matching the match parameter.
+ */
void ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match);
int ast_category_delete(struct ast_config *cfg, const char *category);
int ast_category_empty(struct ast_config *cfg, const char *category);
Modified: team/jpeeler/manager-configactions/main/config.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/manager-configactions/main/config.c?view=diff&rev=103328&r1=103327&r2=103328
==============================================================================
--- team/jpeeler/manager-configactions/main/config.c (original)
+++ team/jpeeler/manager-configactions/main/config.c Mon Feb 11 17:38:59 2008
@@ -362,7 +362,7 @@
if (!variable || sscanf(line, "%d", &insertline) != 1)
return;
- if (insertline == 0) {
+ if (!insertline) {
variable->next = category->root;
category->root = variable;
} else {
@@ -512,13 +512,13 @@
if (!strcasecmp(config->root->name, match)) {
cat->next = config->root;
config->root = cat;
- } else {
- for (cur_category = config->root; cur_category; cur_category = cur_category->next) {
- if (!strcasecmp(cur_category->next->name, match)) {
- cat->next = cur_category->next;
- cur_category->next = cat;
- break;
- }
+ return;
+ }
+ for (cur_category = config->root; cur_category; cur_category = cur_category->next) {
+ if (!strcasecmp(cur_category->next->name, match)) {
+ cat->next = cur_category->next;
+ cur_category->next = cat;
+ break;
}
}
}
Modified: team/jpeeler/manager-configactions/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/manager-configactions/main/manager.c?view=diff&rev=103328&r1=103327&r2=103328
==============================================================================
--- team/jpeeler/manager-configactions/main/manager.c (original)
+++ team/jpeeler/manager-configactions/main/manager.c Mon Feb 11 17:38:59 2008
@@ -1262,12 +1262,11 @@
if (!strcasecmp(action, "newcat")) {
if (ast_strlen_zero(cat))
return UNSPECIFIED_CATEGORY;
- if (!(category = ast_category_new(cat, dfn, -1))) /* TODO: -1 seems ok like in res_config_ldap.c */
+ if (!(category = ast_category_new(cat, dfn, -1)))
return FAILURE_ALLOCATION;
if (ast_strlen_zero(match)) {
ast_category_append(cfg, category);
- }
- else
+ } else
ast_category_insert(cfg, category, match);
} else if (!strcasecmp(action, "renamecat")) {
if (ast_strlen_zero(cat) || ast_strlen_zero(value))
More information about the asterisk-commits
mailing list