[asterisk-commits] seanbright: branch group/asterisk-cpp r168529 - in /team/group/asterisk-cpp: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 12 17:51:18 CST 2009


Author: seanbright
Date: Mon Jan 12 17:51:18 2009
New Revision: 168529

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168529
Log:
A few more (clioriginate and clialiases)

Modified:
    team/group/asterisk-cpp/include/asterisk/cli.h
    team/group/asterisk-cpp/res/res_clialiases.c
    team/group/asterisk-cpp/res/res_clioriginate.c

Modified: team/group/asterisk-cpp/include/asterisk/cli.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/cli.h?view=diff&rev=168529&r1=168528&r2=168529
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/cli.h (original)
+++ team/group/asterisk-cpp/include/asterisk/cli.h Mon Jan 12 17:51:18 2009
@@ -157,6 +157,7 @@
  * \arg \ref CLI_command_API
  */
 struct ast_cli_entry {
+	ast_cli_entry() {}
 	ast_cli_entry(cli_fn h, const char *s) : summary(s), handler(h) {}
 	char *cmda[AST_MAX_CMD_LEN];	/*!< words making up the command.
 						* set the first entry to NULL for a new-style entry. */

Modified: team/group/asterisk-cpp/res/res_clialiases.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/res/res_clialiases.c?view=diff&rev=168529&r1=168528&r2=168529
==============================================================================
--- team/group/asterisk-cpp/res/res_clialiases.c (original)
+++ team/group/asterisk-cpp/res/res_clialiases.c Mon Jan 12 17:51:18 2009
@@ -43,6 +43,9 @@
 static const char config_file[] = "cli_aliases.conf";
 
 struct cli_alias {
+    cli_alias(const char *command) : alias(NULL), real_cmd(NULL) {
+		cli_entry.command = command;
+	}
 	struct ast_cli_entry cli_entry; /*!< Actual CLI structure used for this alias */
 	char *alias;                    /*!< CLI Alias */
 	char *real_cmd;                 /*!< Actual CLI command it is aliased to */
@@ -53,14 +56,16 @@
 /*! \brief Hashing function used for aliases */
 static int alias_hash_cb(const void *obj, const int flags)
 {
-	const struct cli_alias *alias = obj;
+	const struct cli_alias *alias = (const struct cli_alias *) obj;
 	return ast_str_hash(alias->cli_entry.command);
 }
 
 /*! \brief Comparison function used for aliases */
 static int alias_cmp_cb(void *obj, void *arg, int flags)
 {
-	const struct cli_alias *alias0 = obj, *alias1 = arg;
+	const struct cli_alias
+		*alias0 = (const struct cli_alias *) obj,
+		*alias1 = (const struct cli_alias *) arg;
 
 	return (alias0->cli_entry.command == alias1->cli_entry.command ? CMP_MATCH | CMP_STOP : 0);
 }
@@ -68,7 +73,7 @@
 /*! \brief Destruction function used for aliases */
 static void alias_destroy(void *obj)
 {
-	struct cli_alias *alias = obj;
+	struct cli_alias *alias = (struct cli_alias *) obj;
 
 	/* Unregister the CLI entry from the core */
 	ast_cli_unregister(&alias->cli_entry);
@@ -80,14 +85,12 @@
 static char *cli_alias_passthrough(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct cli_alias *alias;
-	struct cli_alias tmp = {
-		.cli_entry.command = e->command,
-	};
+	struct cli_alias tmp(e->command);
 	char *generator;
 	const char *line;
 
 	/* Try to find the alias based on the CLI entry */
-	if (!(alias = ao2_find(cli_aliases, &tmp, OBJ_POINTER))) {
+	if (!(alias = (struct cli_alias *) ao2_find(cli_aliases, &tmp, OBJ_POINTER))) {
 		return 0;
 	}
 
@@ -153,7 +156,7 @@
 
 	i = ao2_iterator_init(cli_aliases, 0);
 
-	for (; (alias = ao2_iterator_next(&i)); ao2_ref(alias, -1)) {
+	for (; (alias = (struct cli_alias *) ao2_iterator_next(&i)); ao2_ref(alias, -1)) {
 		ast_cli(a->fd, FORMAT, alias->alias, alias->real_cmd);
 	}
 
@@ -189,7 +192,7 @@
 
 	/* Destroy any existing CLI aliases */
 	if (reload) {
-		ao2_callback(cli_aliases, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE , alias_marked, NULL);
+		ao2_callback(cli_aliases, (enum search_flags) (OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE), alias_marked, NULL);
 	}
 
 	for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
@@ -199,7 +202,7 @@
 		}
 		/* Read in those there CLI aliases */
 		for (v1 = ast_variable_browse(cfg, v->value); v1; v1 = v1->next) {
-			if (!(alias = ao2_alloc((sizeof(*alias) + strlen(v1->name) + strlen(v1->value) + 2), alias_destroy))) {
+			if (!(alias = (struct cli_alias *) ao2_alloc((sizeof(*alias) + strlen(v1->name) + strlen(v1->value) + 2), alias_destroy))) {
 				continue;
 			}
 			alias->alias = ((char *) alias) + sizeof(*alias);
@@ -240,7 +243,7 @@
 }
 
 /*! \brief Function called to load the module */
-static int load_module(void)
+static enum ast_module_load_result load_module(void)
 {
 	if (!(cli_aliases = ao2_container_alloc(MAX_ALIAS_BUCKETS, alias_hash_cb, alias_cmp_cb))) {
 		return AST_MODULE_LOAD_DECLINE;
@@ -254,7 +257,7 @@
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "CLI Aliases",
-		.load = load_module,
-		.unload = unload_module,
-		.reload = reload_module,
-		);
+				load_module,
+				unload_module,
+				reload_module
+	);

Modified: team/group/asterisk-cpp/res/res_clioriginate.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/res/res_clioriginate.c?view=diff&rev=168529&r1=168528&r2=168529
==============================================================================
--- team/group/asterisk-cpp/res/res_clioriginate.c (original)
+++ team/group/asterisk-cpp/res/res_clioriginate.c Mon Jan 12 17:51:18 2009
@@ -81,7 +81,7 @@
 {
 	char *chantech;
 	char *chandata;
-	char *exten = NULL;
+	const char *exten = NULL;
 	char *context = NULL;
 	int reason = 0;
 
@@ -101,7 +101,7 @@
 	if (ast_strlen_zero(exten))
 		exten = "s";
 	if (ast_strlen_zero(context))
-		context = "default";
+		context = (char *) "default";
 	
 	ast_pbx_outgoing_exten(chantech, AST_FORMAT_SLINEAR, chandata, TIMEOUT * 1000, context, exten, 1, &reason, 0, NULL, NULL, NULL, NULL, NULL);
 
@@ -118,7 +118,7 @@
 */
 static char *handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	static char *choices[] = { "application", "extension", NULL };
+	static const char *choices[] = { "application", "extension", NULL };
 	char *res;
 	switch (cmd) {
 	case CLI_INIT:
@@ -230,7 +230,7 @@
 	return ast_cli_unregister_multiple(cli_cliorig, ARRAY_LEN(cli_cliorig));
 }
 
-static int load_module(void)
+static ast_module_load_result load_module(void)
 {
 	int res;
 	res = ast_cli_register_multiple(cli_cliorig, ARRAY_LEN(cli_cliorig));




More information about the asterisk-commits mailing list