[vlc-commits] plugin: add set_callback() macro
Rémi Denis-Courmont
git at videolan.org
Thu Jul 18 17:59:05 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jul 17 22:48:10 2019 +0300| [de772bf48b7292f3f629de9f05dd980ad3a463c8] | committer: Rémi Denis-Courmont
plugin: add set_callback() macro
This avoids registering NULL as a deactivate callback.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de772bf48b7292f3f629de9f05dd980ad3a463c8
---
include/vlc_plugin.h | 8 ++++++--
src/modules/entry.c | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index b16a313d1d..9f363eda57 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -302,9 +302,13 @@ VLC_METADATA_EXPORTS
|| vlc_module_set (VLC_MODULE_SCORE, (int)(score))) \
goto error;
+#define set_callback(activate) \
+ if (vlc_module_set(VLC_MODULE_CB_OPEN, #activate, (void *)(activate))) \
+ goto error;
+
#define set_callbacks( activate, deactivate ) \
- if (vlc_module_set(VLC_MODULE_CB_OPEN, #activate, (void *)(activate)) \
- || vlc_module_set(VLC_MODULE_CB_CLOSE, #deactivate, \
+ set_callback(activate) \
+ if (vlc_module_set(VLC_MODULE_CB_CLOSE, #deactivate, \
(void *)(deactivate))) \
goto error;
diff --git a/src/modules/entry.c b/src/modules/entry.c
index bce94285c6..21eb09bf3c 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -570,7 +570,7 @@ static int vlc_plugin_get_symbol(void *root, const char *name,
void **restrict addrp)
{
if (name == NULL)
- { /* TODO: use this; do not define "NULL" as a name for NULL? */
+ {
*addrp = NULL;
return 0;
}
More information about the vlc-commits
mailing list