aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-14 14:08:19 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-14 14:08:19 +0000
commit3664249356aa4768fcb0b3b8e6cf9365fcbd0c8d (patch)
treeb68f48482e463e9c31126b2e3e24fca1dd2f6c82 /res
parentf9d382fc079246930a99640d7835d6ae3e4149db (diff)
This rather large commit changes the way modules are loaded.
As partly documented in loader.c and include/asterisk/module.h, modules are now expected to return all of their methods and flags into a structure 'mod_data', and are normally loaded with RTLD_NOW | RTLD_LOCAL, so symbols are resolved immediately and conflicts should be less likely. Only in a small number of cases (res_*, typically) modules are loaded RTLD_GLOBAL, so they can export symbols. The core of the change is only the two files loader.c and include/asterisk/module.h, all the rest is simply adaptation of the existing modules to the new API, a rather mechanical (but believe me, time and finger-consuming!) process whose detail you can figure out by svn diff'ing any single module. Expect some minor compilation issue after this change, please report it on mantis http://bugs.digium.com/view.php?id=6968 so we collect all the feedback in one place. I am just sorry that this change missed SVN version number 20000! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20003 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_adsi.c18
-rw-r--r--res/res_agi.c26
-rw-r--r--res/res_clioriginate.c28
-rw-r--r--res/res_config_odbc.c19
-rw-r--r--res/res_config_pgsql.c17
-rw-r--r--res/res_convert.c24
-rw-r--r--res/res_crypto.c17
-rw-r--r--res/res_features.c29
-rw-r--r--res/res_indications.c24
-rw-r--r--res/res_monitor.c25
-rw-r--r--res/res_musiconhold.c25
-rw-r--r--res/res_odbc.c20
-rw-r--r--res/res_smdi.c33
-rw-r--r--res/res_speech.c25
14 files changed, 119 insertions, 211 deletions
diff --git a/res/res_adsi.c b/res/res_adsi.c
index ca0da1f36..730b336d1 100644
--- a/res/res_adsi.c
+++ b/res/res_adsi.c
@@ -1107,36 +1107,32 @@ static void adsi_load(void)
}
}
-int reload(void)
+static int reload(void *mod)
{
adsi_load();
return 0;
}
-int load_module(void)
+static int load_module(void *mod)
{
adsi_load();
return 0;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
/* Can't unload this once we're loaded */
return -1;
}
-const char *description(void)
+static const char *description(void)
{
return "ADSI Resource";
}
-int usecount(void)
-{
- /* We should never be unloaded */
- return 1;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL);
diff --git a/res/res_agi.c b/res/res_agi.c
index 9f16c9faa..c00715783 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -95,7 +95,7 @@ static char *descrip =
static int agidebug = 0;
-LOCAL_USER_DECL;
+struct module_symbols *me;
#define TONE_BLOCK_SIZE 200
@@ -1952,7 +1952,7 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
argv[argc++] = stringp;
argv[argc] = NULL;
- LOCAL_USER_ADD(u);
+ u = ast_localuser_add(me, chan);
#if 0
/* Answer if need be */
if (chan->_state != AST_STATE_UP) {
@@ -1972,7 +1972,7 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
if (efd > -1)
close(efd);
}
- LOCAL_USER_REMOVE(u);
+ ast_localuser_remove(me, u);
return res;
}
@@ -2026,9 +2026,9 @@ static struct ast_cli_entry showagi =
static struct ast_cli_entry dumpagihtml =
{ { "dump", "agihtml", NULL }, handle_dumpagihtml, "Dumps a list of agi command in html format", dumpagihtml_help };
-int unload_module(void)
+static int unload_module(void *mod)
{
- STANDARD_HANGUP_LOCALUSERS;
+ ast_hangup_localusers(mod);
ast_cli_unregister(&showagi);
ast_cli_unregister(&dumpagihtml);
ast_cli_unregister(&cli_debug);
@@ -2038,8 +2038,9 @@ int unload_module(void)
return ast_unregister_application(app);
}
-int load_module(void)
+static int load_module(void *mod)
{
+ me = mod;
ast_cli_register(&showagi);
ast_cli_register(&dumpagihtml);
ast_cli_register(&cli_debug);
@@ -2049,21 +2050,14 @@ int load_module(void)
return ast_register_application(app, agi_exec, synopsis, descrip);
}
-const char *description(void)
+static const char *description(void)
{
return "Asterisk Gateway Interface (AGI)";
-
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
}
-const char *key(void)
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_0, NULL, NULL, NULL);
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index 6a26bc23c..a9ebb3647 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -42,7 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
/*! The timeout for originated calls, in seconds */
#define TIMEOUT 30
-STANDARD_USECOUNT_DECL;
+static struct module_symbols *me;
static char orig_help[] =
" There are two ways to use this command. A call can be originated between a\n"
@@ -132,7 +132,7 @@ static int handle_orig(int fd, int argc, char *argv[])
if (ast_strlen_zero(argv[1]) || ast_strlen_zero(argv[2]))
return RESULT_SHOWUSAGE;
- STANDARD_INCREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, +1);
if (!strcasecmp("application", argv[2])) {
res = orig_app(argv[1], argv[3], argv[4]);
@@ -141,7 +141,7 @@ static int handle_orig(int fd, int argc, char *argv[])
} else
res = RESULT_SHOWUSAGE;
- STANDARD_DECREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, -1);
return res;
}
@@ -154,38 +154,32 @@ static char *complete_orig(const char *line, const char *word, int pos, int stat
if (pos != 2)
return NULL;
- STANDARD_INCREMENT_USECOUNT;
-
+ ast_atomic_fetchadd_int(&me->usecnt, +1);
ret = ast_cli_complete(word, choices, state);
-
- STANDARD_DECREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, -1);
return ret;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_cli_unregister(&cli_orig);
}
-int load_module(void)
+static int load_module(void *mod)
{
+ me = mod;
return ast_cli_register(&cli_orig);
}
-const char *description(void)
+static const char *description(void)
{
return "Call origination from the CLI";
-
-}
-
-int usecount(void)
-{
- return 0;
}
-const char *key(void)
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_0 | NO_USECOUNT, NULL, NULL, NULL);
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index b28059db5..f2634a93c 100644
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -506,16 +506,16 @@ static struct ast_config_engine odbc_engine = {
.update_func = update_odbc
};
-int unload_module (void)
+static int unload_module (void *mod)
{
+ ast_hangup_localusers(mod);
ast_config_engine_deregister(&odbc_engine);
if (option_verbose)
ast_verbose("res_config_odbc unloaded.\n");
- STANDARD_HANGUP_LOCALUSERS;
return 0;
}
-int load_module (void)
+static int load_module (void *mod)
{
ast_config_engine_register(&odbc_engine);
if (option_verbose)
@@ -523,19 +523,14 @@ int load_module (void)
return 0;
}
-const char *description(void)
+static const char *description(void)
{
return "ODBC Configuration";
-
}
-int usecount (void)
-{
- /* never unload a config module */
- return 1;
-}
-
-const char *key(void)
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL);
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index cf3838654..ecdce4dd1 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -547,7 +547,7 @@ static struct ast_config_engine pgsql_engine = {
.update_func = update_pgsql
};
-int load_module(void)
+static int load_module(void *mod)
{
parse_config();
@@ -571,7 +571,7 @@ int load_module(void)
return 0;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
/* Aquire control before doing anything to the module itself. */
ast_mutex_lock(&pgsql_lock);
@@ -594,7 +594,7 @@ int unload_module(void)
return 0;
}
-int reload(void)
+static int reload(void *mod)
{
/* Aquire control before doing anything to the module itself. */
ast_mutex_lock(&pgsql_lock);
@@ -691,14 +691,15 @@ int parse_config(void)
return 1;
}
-const char *description(void)
+static const char *description(void)
{
return "Postgresql RealTime Configuration Driver";
}
-int usecount(void)
+static int usecount(void)
{
+ /* XXX check this... */
/* Try and get a lock. If unsuccessful, than that means another thread is using the pgsql object. */
if (ast_mutex_trylock(&pgsql_lock)) {
ast_log(LOG_DEBUG, "Postgresql RealTime: Module usage count is 1.\n");
@@ -708,11 +709,17 @@ int usecount(void)
return 0;
}
+<<<<<<< .mine
+static const char *key(void)
+=======
const char *key(void)
+>>>>>>> .r19220
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_0, NULL, NULL, NULL);
+
static int pgsql_reconnect(const char *database)
{
char my_database[50];
diff --git a/res/res_convert.c b/res/res_convert.c
index be441bc4b..553075874 100644
--- a/res/res_convert.c
+++ b/res/res_convert.c
@@ -39,7 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/cli.h"
#include "asterisk/file.h"
-STANDARD_USECOUNT_DECL;
+struct module_symbols *me;
/*! \brief Split the filename to basename and extension */
static int split_ext(char *filename, char **name, char **ext)
@@ -65,7 +65,7 @@ static int cli_audio_convert(int fd, int argc, char *argv[])
char *file_in = NULL, *file_out = NULL;
char *name_in, *ext_in, *name_out, *ext_out;
- STANDARD_INCREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, +1);
if (argc != 3 || ast_strlen_zero(argv[1]) || ast_strlen_zero(argv[2])) {
ret = RESULT_SHOWUSAGE;
@@ -116,7 +116,7 @@ fail_out:
if (fs_in)
ast_closestream(fs_in);
- STANDARD_DECREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, -1);
return ret;
}
@@ -132,31 +132,25 @@ static struct ast_cli_entry audio_convert_cli={
{ "convert" , NULL }, cli_audio_convert, "Convert audio files", usage_audio_convert
};
-int unload_module(void)
+static int unload_module(void *mod)
{
return ast_cli_unregister(&audio_convert_cli);
}
-int load_module(void)
+static int load_module(void *mod)
{
+ me = mod;
return ast_cli_register(&audio_convert_cli);
}
-const char *description(void)
+static const char *description(void)
{
return "File format conversion CLI command";
-
-}
-
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
}
-const char *key(void)
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD1;
diff --git a/res/res_crypto.c b/res/res_crypto.c
index ea0f05ae6..d7c74d79f 100644
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -581,13 +581,13 @@ static int crypto_init(void)
return 0;
}
-int reload(void)
+static int reload(void *mod)
{
crypto_load(-1, -1);
return 0;
}
-int load_module(void)
+static int load_module(void *mod)
{
crypto_init();
if (ast_opt_init_keys)
@@ -597,24 +597,19 @@ int load_module(void)
return 0;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
/* Can't unload this once we're loaded */
return -1;
}
-const char *description(void)
+static const char *description(void)
{
return "Cryptographic Digital Signatures";
}
-int usecount(void)
-{
- /* We should never be unloaded */
- return 1;
-}
-
-const char *key(void)
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL);
diff --git a/res/res_features.c b/res/res_features.c
index b114d23c0..f29ec9d45 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -142,8 +142,6 @@ AST_MUTEX_DEFINE_STATIC(parking_lock);
static pthread_t parking_thread;
-LOCAL_USER_DECL;
-
char *ast_parking_ext(void)
{
return parking_ext;
@@ -2201,14 +2199,16 @@ static int load_config(void)
return ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), FREE, registrar);
}
-int reload(void) {
+static int reload(void *mod)
+{
return load_config();
}
-int load_module(void)
+static int load_module(void *mod)
{
int res;
+ __mod_desc = mod;
AST_LIST_HEAD_INIT(&feature_list);
memset(parking_ext, 0, sizeof(parking_ext));
memset(parking_con, 0, sizeof(parking_con));
@@ -2230,7 +2230,7 @@ int load_module(void)
}
-int unload_module(void)
+static int unload_module(void *mod)
{
STANDARD_HANGUP_LOCALUSERS;
@@ -2242,25 +2242,14 @@ int unload_module(void)
return ast_unregister_application(parkedcall);
}
-const char *description(void)
+static const char *description(void)
{
return "Call Features Resource";
}
-int usecount(void)
-{
- /* Never allow parking to be unloaded because it will
- unresolve needed symbols in the dialer */
-#if 0
- int res;
- STANDARD_USECOUNT(res);
- return res;
-#else
- return 1;
-#endif
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0 | NO_UNLOAD, reload, NULL, NULL);
diff --git a/res/res_indications.c b/res/res_indications.c
index 8e468c38a..f4777e3c9 100644
--- a/res/res_indications.c
+++ b/res/res_indications.c
@@ -50,7 +50,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
/* Globals */
-static const char dtext[] = "Indications Configuration";
static const char config[] = "indications.conf";
/*
@@ -364,7 +363,7 @@ static struct ast_cli_entry show_indications_cli =
/*
* Standard module functions ...
*/
-int unload_module(void)
+static int unload_module(void *mod)
{
/* remove the registed indications... */
ast_unregister_indication_country(NULL);
@@ -379,9 +378,10 @@ int unload_module(void)
}
-int load_module(void)
+static int load_module(void *mod)
{
- if (ind_load_module()) return -1;
+ if (ind_load_module())
+ return -1;
ast_cli_register(&add_indication_cli);
ast_cli_register(&remove_indication_cli);
@@ -392,7 +392,7 @@ int load_module(void)
return 0;
}
-int reload(void)
+static int reload(void *mod)
{
/* remove the registed indications... */
ast_unregister_indication_country(NULL);
@@ -400,18 +400,14 @@ int reload(void)
return ind_load_module();
}
-const char *description(void)
+static const char *description(void)
{
- /* that the following cast is needed, is yuk! */
- return (char*)dtext;
+ return "Indications Configuration";
}
-int usecount(void)
-{
- return 0;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0 | NO_USECOUNT, reload, NULL, NULL);
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 6c00c593c..e570e726b 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -31,8 +31,6 @@
#include <sys/stat.h>
#include <libgen.h> /* dirname() */
-#define STATIC_MODULE
-
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -647,7 +645,7 @@ static int unpause_monitor_action(struct mansession *s, struct message *m)
}
-STATIC_MODULE int load_module(void)
+static int load_module(void *mod)
{
ast_register_application("Monitor", start_monitor_exec, monitor_synopsis, monitor_descrip);
ast_register_application("StopMonitor", stop_monitor_exec, stopmonitor_synopsis, stopmonitor_descrip);
@@ -663,7 +661,7 @@ STATIC_MODULE int load_module(void)
return 0;
}
-STATIC_MODULE int unload_module(void)
+static int unload_module(void *mod)
{
ast_unregister_application("Monitor");
ast_unregister_application("StopMonitor");
@@ -679,27 +677,14 @@ STATIC_MODULE int unload_module(void)
return 0;
}
-STATIC_MODULE const char *description(void)
+static const char *description(void)
{
return "Call Monitoring Resource";
}
-STATIC_MODULE int usecount(void)
-{
- /* Never allow monitor to be unloaded because it will
- unresolve needed symbols in the channel */
-#if 0
- int res;
- STANDARD_USECOUNT(res);
- return res;
-#else
- return 1;
-#endif
-}
-
-STATIC_MODULE const char *key(void)
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
-STD_MOD(MOD_0, NULL, NULL, NULL); /* MOD_0 because it exports some symbols */
+STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL); /* MOD_0 because it exports some symbols */
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index e82d6fa19..9b1113a44 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1164,7 +1164,7 @@ static int init_classes(int reload)
return 1;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res;
@@ -1191,7 +1191,7 @@ int load_module(void)
return 0;
}
-int reload(void)
+static int reload(void *mod)
{
if (init_classes(1))
ast_install_music_functions(local_ast_moh_start, local_ast_moh_stop, local_ast_moh_cleanup);
@@ -1199,30 +1199,19 @@ int reload(void)
return 0;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
return -1;
}
-const char *description(void)
+static const char *description(void)
{
return "Music On Hold Resource";
}
-int usecount(void)
-{
- /* Never allow Music On Hold to be unloaded
- unresolve needed symbols in the dialer */
-#if 0
- int res;
- STANDARD_USECOUNT(res);
- return res;
-#else
- return 1;
-#endif
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, reload, NULL, NULL);
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 3093c1f07..cc255844d 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -106,7 +106,6 @@ static void odbc_init(void)
}
}
-static char *tdesc = "ODBC Resource";
/* internal stuff */
SQLHSTMT odbc_prepare_and_execute(odbc_obj *obj, SQLHSTMT (*prepare_cb)(odbc_obj *obj, void *data), void *data)
@@ -578,7 +577,7 @@ odbc_status odbc_obj_connect(odbc_obj *obj)
LOCAL_USER_DECL;
-int unload_module(void)
+static int unload_module(void *mod)
{
STANDARD_HANGUP_LOCALUSERS;
odbc_destroy();
@@ -589,7 +588,7 @@ int unload_module(void)
return 0;
}
-int load_module(void)
+static int load_module(void *mod)
{
odbc_init();
load_odbc_config();
@@ -600,19 +599,14 @@ int load_module(void)
return 0;
}
-const char *description(void)
+static const char *description(void)
{
- return tdesc;
+ return "ODBC Resource";
}
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0, NULL, NULL, NULL);
diff --git a/res/res_smdi.c b/res/res_smdi.c
index 681fd7f41..2f8515440 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -48,7 +48,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
/* Message expiry time in milliseconds */
#define SMDI_MSG_EXPIRY_TIME 30000 /* 30 seconds */
-static const char tdesc[] = "Asterisk Simplified Message Desk Interface (SMDI) Module";
static const char config_file[] = "smdi.conf";
static void ast_smdi_md_message_push(struct ast_smdi_interface *iface, struct ast_smdi_md_message *msg);
@@ -57,9 +56,7 @@ static void ast_smdi_mwi_message_push(struct ast_smdi_interface *iface, struct a
static void *smdi_read(void *iface_p);
static int smdi_load(int reload);
-/* Use count stuff */
-
-LOCAL_USER_DECL;
+struct module_symbols *me; /* initialized in load_module() */
/*! \brief SMDI interface container. */
struct ast_smdi_interface_container {
@@ -504,7 +501,7 @@ void ast_smdi_interface_destroy(struct ast_smdi_interface *iface)
ASTOBJ_CONTAINER_DESTROY(&iface->mwi_q);
free(iface);
- STANDARD_DECREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, -1);
}
/*!
@@ -688,7 +685,7 @@ static int smdi_load(int reload)
ASTOBJ_CONTAINER_LINK(&smdi_ifaces, iface);
ASTOBJ_UNREF(iface, ast_smdi_interface_destroy);
- STANDARD_INCREMENT_USECOUNT;
+ ast_atomic_fetchadd_int(&me->usecnt, +1);
} else {
ast_log(LOG_NOTICE, "Ignoring unknown option %s in %s\n", v->name, config_file);
}
@@ -709,15 +706,16 @@ static int smdi_load(int reload)
}
-const char *description(void)
+static const char *description(void)
{
- return (char *) tdesc;
+ return "Asterisk Simplified Message Desk Interface (SMDI) Module";
}
-int load_module(void)
+static int load_module(void *mod)
{
int res;
+ me = mod;
/* initialize our containers */
memset(&smdi_ifaces, 0, sizeof(smdi_ifaces));
ASTOBJ_CONTAINER_INIT(&smdi_ifaces);
@@ -733,7 +731,7 @@ int load_module(void)
return 0;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
/* this destructor stops any running smdi_read threads */
ASTOBJ_CONTAINER_DESTROYALL(&smdi_ifaces, ast_smdi_interface_destroy);
@@ -742,7 +740,7 @@ int unload_module(void)
return 0;
}
-int reload(void)
+static int reload(void *mod)
{
int res;
@@ -757,16 +755,9 @@ int reload(void)
return 0;
}
-int usecount(void)
-{
- int res;
-
- STANDARD_USECOUNT(res);
-
- return res;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0, reload, NULL, NULL);
diff --git a/res/res_speech.c b/res/res_speech.c
index 58ef56447..32b15d79e 100644
--- a/res/res_speech.c
+++ b/res/res_speech.c
@@ -41,7 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
#include "asterisk/options.h"
#include "asterisk/speech.h"
-static char *tdesc = "Generic Speech Recognition API";
static AST_LIST_HEAD_STATIC(engines, ast_speech_engine);
static struct ast_speech_engine *default_engine = NULL;
@@ -337,13 +336,13 @@ int ast_speech_unregister(char *engine_name)
return res;
}
-int unload_module(void)
+static int unload_module(void *mod)
{
/* We can not be unloaded */
return -1;
}
-int load_module(void)
+static int load_module(void *mod)
{
int res = 0;
@@ -353,24 +352,14 @@ int load_module(void)
return res;
}
-int reload(void)
+static const char *description(void)
{
- return 0;
+ return "Generic Speech Recognition API";
}
-const char *description(void)
-{
- return tdesc;
-}
-
-int usecount(void)
-{
- int res = 0;
-
- return res;
-}
-
-const char *key()
+static const char *key(void)
{
return ASTERISK_GPL_KEY;
}
+
+STD_MOD(MOD_0 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL);