diff options
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/cli-command.c | 2 | ||||
-rw-r--r-- | src/pulsecore/ltdl-helper.h | 1 | ||||
-rw-r--r-- | src/pulsecore/modinfo.c | 5 | ||||
-rw-r--r-- | src/pulsecore/modinfo.h | 1 | ||||
-rw-r--r-- | src/pulsecore/module.c | 9 | ||||
-rw-r--r-- | src/pulsecore/module.h | 4 |
6 files changed, 21 insertions, 1 deletions
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 15fe525c..dad647a8 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -483,6 +483,8 @@ static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, if (i->usage) pa_strbuf_printf(buf, "Usage: %s\n", i->usage); pa_strbuf_printf(buf, "Load Once: %s\n", pa_yes_no(i->load_once)); + if (i->deprecated) + pa_strbuf_printf(buf, "Warning, deprecated: %s\n", i->deprecated); } pa_modinfo_free(i); diff --git a/src/pulsecore/ltdl-helper.h b/src/pulsecore/ltdl-helper.h index 4c4f018a..9f346969 100644 --- a/src/pulsecore/ltdl-helper.h +++ b/src/pulsecore/ltdl-helper.h @@ -29,4 +29,3 @@ typedef void (*pa_void_func_t)(void); pa_void_func_t pa_load_sym(lt_dlhandle handle, const char*module, const char *symbol); #endif - diff --git a/src/pulsecore/modinfo.c b/src/pulsecore/modinfo.c index 00fb9c43..b5ee9f56 100644 --- a/src/pulsecore/modinfo.c +++ b/src/pulsecore/modinfo.c @@ -38,6 +38,7 @@ #define PA_SYMBOL_DESCRIPTION "pa__get_description" #define PA_SYMBOL_USAGE "pa__get_usage" #define PA_SYMBOL_VERSION "pa__get_version" +#define PA_SYMBOL_DEPRECATED "pa__get_deprecated" #define PA_SYMBOL_LOAD_ONCE "pa__load_once" pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_name) { @@ -61,6 +62,9 @@ pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_name) { if ((func = (const char* (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_VERSION))) i->version = pa_xstrdup(func()); + if ((func = (const char* (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_DEPRECATED))) + i->deprecated = pa_xstrdup(func()); + if ((func2 = (pa_bool_t (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_LOAD_ONCE))) i->load_once = func2(); @@ -91,5 +95,6 @@ void pa_modinfo_free(pa_modinfo *i) { pa_xfree(i->description); pa_xfree(i->usage); pa_xfree(i->version); + pa_xfree(i->deprecated); pa_xfree(i); } diff --git a/src/pulsecore/modinfo.h b/src/pulsecore/modinfo.h index 407e602a..baad0de7 100644 --- a/src/pulsecore/modinfo.h +++ b/src/pulsecore/modinfo.h @@ -30,6 +30,7 @@ typedef struct pa_modinfo { char *description; char *usage; char *version; + char *deprecated; pa_bool_t load_once; } pa_modinfo; diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c index 42fd912c..5bcdd898 100644 --- a/src/pulsecore/module.c +++ b/src/pulsecore/module.c @@ -48,10 +48,12 @@ #define PA_SYMBOL_DONE "pa__done" #define PA_SYMBOL_LOAD_ONCE "pa__load_once" #define PA_SYMBOL_GET_N_USED "pa__get_n_used" +#define PA_SYMBOL_GET_DEPRECATE "pa__get_deprecated" pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { pa_module *m = NULL; pa_bool_t (*load_once)(void); + const char* (*get_deprecated)(void); pa_modinfo *mi; pa_assert(c); @@ -89,6 +91,13 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { } } + if ((get_deprecated = (const char* (*) (void)) pa_load_sym(m->dl, name, PA_SYMBOL_GET_DEPRECATE))) { + const char *t; + + if ((t = get_deprecated())) + pa_log_warn("%s is deprecated: %s", name, t); + } + if (!(m->init = (int (*)(pa_module*_m)) pa_load_sym(m->dl, name, PA_SYMBOL_INIT))) { pa_log("Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.", name); goto fail; diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h index 3f697348..af89d793 100644 --- a/src/pulsecore/module.h +++ b/src/pulsecore/module.h @@ -78,6 +78,10 @@ int pa_module_get_n_used(pa_module*m); const char * pa__get_version(void) { return s; } \ struct __stupid_useless_struct_to_allow_trailing_semicolon +#define PA_MODULE_DEPRECATED(s) \ + const char * pa__get_deprecated(void) { return s; } \ + struct __stupid_useless_struct_to_allow_trailing_semicolon + #define PA_MODULE_LOAD_ONCE(b) \ pa_bool_t pa__load_once(void) { return b; } \ struct __stupid_useless_struct_to_allow_trailing_semicolon |