[asterisk-commits] branch group/new_loader_completion r29062 - in /team/group/new_loader_complet...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat May 20 13:01:36 MST 2006


Author: kpfleming
Date: Sat May 20 15:01:35 2006
New Revision: 29062

URL: http://svn.digium.com/view/asterisk?rev=29062&view=rev
Log:
first steps towarding using constructors to register modules

Modified:
    team/group/new_loader_completion/codecs/codec_ulaw.c
    team/group/new_loader_completion/include/asterisk/module.h
    team/group/new_loader_completion/loader.c

Modified: team/group/new_loader_completion/codecs/codec_ulaw.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/codecs/codec_ulaw.c?rev=29062&r1=29061&r2=29062&view=diff
==============================================================================
--- team/group/new_loader_completion/codecs/codec_ulaw.c (original)
+++ team/group/new_loader_completion/codecs/codec_ulaw.c Sat May 20 15:01:35 2006
@@ -58,7 +58,6 @@
 	unsigned char *src = f->data;
 	int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples;
 	int in_samples = f->samples;
-	int out_samples = pvt->samples;
 
 	/* convert and copy in outbuf */
 	while (i--)

Modified: team/group/new_loader_completion/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/include/asterisk/module.h?rev=29062&r1=29061&r2=29062&view=diff
==============================================================================
--- team/group/new_loader_completion/include/asterisk/module.h (original)
+++ team/group/new_loader_completion/include/asterisk/module.h Sat May 20 15:01:35 2006
@@ -310,6 +310,9 @@
 	struct ast_cli_entry *clis;
 };
 
+void ast_module_register(const struct ast_module_info *);
+void ast_module_unregister(const struct ast_module_info *);
+
 struct ast_module_user *__ast_module_user_add(struct ast_module *, struct ast_channel *);
 void __ast_module_user_remove(struct ast_module *, struct ast_module_user *);
 void __ast_module_user_hangup_all(struct ast_module *);
@@ -329,11 +332,19 @@
 #if defined(__cplusplus) || defined(c_plusplus)
 extern struct ast_module_info ast_module_info;
 #else
-const struct ast_module_info ast_module_info;
+const static struct ast_module_info ast_module_info;
 #endif
 
 #define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)	\
-	const struct ast_module_info ast_module_info = {	\
+	static void  __attribute__ ((constructor)) __reg_module(void) \
+	{ \
+		ast_module_register(&ast_module_info); \
+	} \
+	static void  __attribute__ ((destructor)) __unreg_module(void) \
+	{ \
+		ast_module_unregister(&ast_module_info); \
+	} \
+	const static struct ast_module_info ast_module_info = {	\
 		.flags = { flags_to_set },			\
 		.description = desc,				\
 		.key = keystr,					\

Modified: team/group/new_loader_completion/loader.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/loader.c?rev=29062&r1=29061&r2=29062&view=diff
==============================================================================
--- team/group/new_loader_completion/loader.c (original)
+++ team/group/new_loader_completion/loader.c Sat May 20 15:01:35 2006
@@ -126,6 +126,14 @@
 static AST_LIST_HEAD_STATIC(module_list, ast_module);
 static AST_LIST_HEAD_STATIC(updaters, loadupdate);
 AST_MUTEX_DEFINE_STATIC(reloadlock);
+
+void ast_module_register(const struct ast_module_info *mod)
+{
+}
+
+void ast_module_unregister(const struct ast_module_info *mod)
+{
+}
 
 /*! \note
  * helper localuser routines.



More information about the asterisk-commits mailing list