[asterisk-commits] kpfleming: trunk r89463 - in /trunk: build_tools/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 20 13:28:10 CST 2007


Author: kpfleming
Date: Tue Nov 20 13:28:10 2007
New Revision: 89463

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89463
Log:
switch compile-time option checking to string storage mode in this branch too

Modified:
    trunk/build_tools/make_buildopts_h
    trunk/include/asterisk/module.h
    trunk/main/loader.c

Modified: trunk/build_tools/make_buildopts_h
URL: http://svn.digium.com/view/asterisk/trunk/build_tools/make_buildopts_h?view=diff&rev=89463&r1=89462&r2=89463
==============================================================================
--- trunk/build_tools/make_buildopts_h (original)
+++ trunk/build_tools/make_buildopts_h Tue Nov 20 13:28:10 2007
@@ -24,11 +24,11 @@
 
 case ${OSARCH} in	# actually we should check build_os
 *BSD|mingw|darwin*)
-	BUILDSUM=`echo ${TMP} | md5`
-	echo "#define AST_BUILDOPT_SUM {0x0, 0x0, 0x0, 0x0} /* dummy */"
+	BUILDSUM=`echo ${TMP} | md5 | cut -c1-32`
 	;;
 *)
-	BUILDSUM=`echo ${TMP} | md5sum`
-	echo "#define AST_BUILDOPT_SUM { 0x`echo -n ${BUILDSUM} | cut -c1-8`, 0x`echo -n ${BUILDSUM} | cut -c9-16`, 0x`echo -n ${BUILDSUM} | cut -c17-24`, 0x`echo -n ${BUILDSUM} | cut -c25-32` }"
+	BUILDSUM=`echo ${TMP} | md5sum | cut -c1-32`
 	;;
 esac
+
+echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""

Modified: trunk/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/module.h?view=diff&rev=89463&r1=89462&r2=89463
==============================================================================
--- trunk/include/asterisk/module.h (original)
+++ trunk/include/asterisk/module.h Tue Nov 20 13:28:10 2007
@@ -194,10 +194,11 @@
 
 struct ast_module_info {
 
-	/*! The 'self' pointer for a module; it will be set by the loader before
-	   it calls the module's load_module() entrypoint, and used by various
-	   other macros that need to identify the module.
-	*/
+	/*!
+	 * The 'self' pointer for a module; it will be set by the loader before
+	 * it calls the module's load_module() entrypoint, and used by various
+	 * other macros that need to identify the module.
+	 */
 
 	struct ast_module *self;
 	enum ast_module_load_result (*load)(void);	/*!< register stuff etc. Optional. */
@@ -216,8 +217,9 @@
 
 	const char *key;
 	unsigned int flags;
+
 	/*! The value of AST_BUILDOPT_SUM when this module was compiled */
-	uint32_t buildopt_sum[4];
+	const char buildopt_sum[33];
 };
 
 void ast_module_register(const struct ast_module_info *);

Modified: trunk/main/loader.c
URL: http://svn.digium.com/view/asterisk/trunk/main/loader.c?view=diff&rev=89463&r1=89462&r2=89463
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Tue Nov 20 13:28:10 2007
@@ -74,7 +74,7 @@
 { 0x87, 0x76, 0x79, 0x35, 0x23, 0xea, 0x3a, 0xd3,
   0x25, 0x2a, 0xbb, 0x35, 0x87, 0xe4, 0x22, 0x24 };
 
-static unsigned int buildopt_sum[4] = AST_BUILDOPT_SUM;
+static char buildopt_sum[33] = AST_BUILDOPT_SUM;
 
 static unsigned int embedding = 1; /* we always start out by registering embedded modules,
 				      since they are here before we dlopen() any
@@ -603,8 +603,6 @@
 
 static unsigned int inspect_module(const struct ast_module *mod)
 {
-	unsigned int buildopt_empty[4] = { 0, };
-
 	if (!mod->info->description) {
 		ast_log(LOG_WARNING, "Module '%s' does not provide a description.\n", mod->resource);
 		return 1;
@@ -620,8 +618,8 @@
 		return 1;
 	}
 
-	if (memcmp(buildopt_empty, mod->info->buildopt_sum, sizeof(buildopt_empty)) &&
-	    memcmp(buildopt_sum, mod->info->buildopt_sum, sizeof(buildopt_sum))) {
+	if (!ast_strlen_zero(mod->info->buildopt_sum) &&
+	    strcmp(buildopt_sum, mod->info->buildopt_sum)) {
 		ast_log(LOG_WARNING, "Module '%s' was not compiled with the same compile-time options as this version of Asterisk.\n", mod->resource);
 		ast_log(LOG_WARNING, "Module '%s' will not be initialized as it may cause instability.\n", mod->resource);
 		return 1;




More information about the asterisk-commits mailing list