[asterisk-commits] rizzo: trunk r47614 - /trunk/main/cli.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 14 09:31:57 MST 2006


Author: rizzo
Date: Tue Nov 14 10:31:57 2006
New Revision: 47614

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47614
Log:
remove duplicated implementation for a deprecated function, use the
original one instead with appropriate changes in argc/argv.

This is not always applicable, but in some simple cases it is.


Modified:
    trunk/main/cli.c

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=47614&r1=47613&r2=47614
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Tue Nov 14 10:31:57 2006
@@ -127,19 +127,9 @@
 "       Optional regular expression pattern is matched to group names for each\n"
 "       channel.\n";
 
-static int handle_load_deprecated(int fd, int argc, char *argv[])
-{
-	if (argc != 2)
-		return RESULT_SHOWUSAGE;
-	if (ast_load_resource(argv[1])) {
-		ast_cli(fd, "Unable to load module %s\n", argv[1]);
-		return RESULT_FAILURE;
-	}
-	return RESULT_SUCCESS;
-}
-
 static int handle_load(int fd, int argc, char *argv[])
 {
+	/* "module load <mod>" */
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
 	if (ast_load_resource(argv[2])) {
@@ -147,6 +137,12 @@
 		return RESULT_FAILURE;
 	}
 	return RESULT_SUCCESS;
+}
+
+static int handle_load_deprecated(int fd, int argc, char *argv[])
+{
+	/* I know it is nasty, but they do look very similar, and we never access argv[0] */
+	return handle_load(fd, argc+1, argv - 1);
 }
 
 static int handle_reload_deprecated(int fd, int argc, char *argv[])



More information about the asterisk-commits mailing list