pa_module_unload() takes two pointers: pa_module and pa_core. The pa_core pointer is also available via the pa_module object, so the pa_core argument is redundant.
Created attachment 116719 [details] [review] Remove redundant core argument from pa_module_unload() From a780ec7b9b160943c318d14d9b80a27cc22ca474 Mon Sep 17 00:00:00 2001 From: Kiran Krishnappa <kiraank@gmail.com> Date: Thu, 25 Jun 2015 21:59:36 +0530 Subject: [PATCH] module: Remove redundant core argument from pa_module_unload() pa_module_unload() takes two pointers: pa_module and pa_core. The pa_core pointer is also available via the pa_module object, so the pa_core argument is redundant --- src/modules/bluetooth/module-bluez4-device.c | 2 +- src/modules/bluetooth/module-bluez5-device.c | 2 +- src/modules/module-zeroconf-publish.c | 2 +- src/pulsecore/core.c | 2 +- src/pulsecore/module.c | 9 ++++----- src/pulsecore/module.h | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c index db69d34..2915d9a 100644 --- a/src/modules/bluetooth/module-bluez4-device.c +++ b/src/modules/bluetooth/module-bluez4-device.c @@ -2417,7 +2417,7 @@ static pa_hook_result_t discovery_hook_cb(pa_bluez4_discovery *y, const pa_bluez else return PA_HOOK_OK; - pa_module_unload(u->core, u->module, true); + pa_module_unload(u->module, true); return PA_HOOK_OK; } diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 6ebcda2..84e6d55 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -2035,7 +2035,7 @@ static pa_hook_result_t device_connection_changed_cb(pa_bluetooth_discovery *y, return PA_HOOK_OK; pa_log_debug("Unloading module for device %s", d->path); - pa_module_unload(u->core, u->module, true); + pa_module_unload(u->module, true); return PA_HOOK_OK; } diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c index ac139e9..ceedfe0 100644 --- a/src/modules/module-zeroconf-publish.c +++ b/src/modules/module-zeroconf-publish.c @@ -643,7 +643,7 @@ static int avahi_process_msg(pa_msgobject *o, int code, void *data, int64_t offs break; case AVAHI_MESSAGE_SHUTDOWN_START: - pa_module_unload(u->core, u->module, true); + pa_module_unload(u->module, true); break; default: diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 0e63bac..43fd30e 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -51,7 +51,7 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, int64_t o switch (code) { case PA_CORE_MESSAGE_UNLOAD_MODULE: - pa_module_unload(c, userdata, true); + pa_module_unload(userdata, true); return 0; default: diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c index 1d4187e..d57aaa3 100644 --- a/src/pulsecore/module.c +++ b/src/pulsecore/module.c @@ -257,16 +257,15 @@ static void pa_module_free(pa_module *m) { pa_xfree(m); } -void pa_module_unload(pa_core *c, pa_module *m, bool force) { - pa_assert(c); +void pa_module_unload(pa_module *m, bool force) { pa_assert(m); if (m->core->disallow_module_loading && !force) return; - pa_hashmap_remove(c->modules_pending_unload, m); + pa_hashmap_remove(m->core->modules_pending_unload, m); - if (!(m = pa_idxset_remove_by_data(c->modules, m, NULL))) + if (!(m = pa_idxset_remove_by_data(m->core->modules, m, NULL))) return; pa_module_free(m); @@ -333,7 +332,7 @@ static void defer_cb(pa_mainloop_api*api, pa_defer_event *e, void *userdata) { api->defer_enable(e, 0); while ((m = pa_hashmap_first(c->modules_pending_unload))) - pa_module_unload(c, m, true); + pa_module_unload(m, true); } void pa_module_unload_request(pa_module *m, bool force) { diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h index 3889156..41e2189 100644 --- a/src/pulsecore/module.h +++ b/src/pulsecore/module.h @@ -54,7 +54,7 @@ bool pa_module_exists(const char *name); pa_module* pa_module_load(pa_core *c, const char *name, const char *argument); -void pa_module_unload(pa_core *c, pa_module *m, bool force); +void pa_module_unload(pa_module *m, bool force); void pa_module_unload_by_index(pa_core *c, uint32_t idx, bool force); void pa_module_unload_request(pa_module *m, bool force); -- 1.9.1
Thanks! Applied now. (And sorry for the late reply.)
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.