[vlc-commits] [Git][videolan/vlc][master] 4 commits: modules: add an assertion
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Wed Feb 23 21:09:15 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
d155c5eb by Rémi Denis-Courmont at 2022-02-23T19:29:39+00:00
modules: add an assertion
- - - - -
d3a795e8 by Rémi Denis-Courmont at 2022-02-23T19:29:39+00:00
modules: improve module_list_cap() documentation
- - - - -
9415e040 by Rémi Denis-Courmont at 2022-02-23T19:29:39+00:00
modules: fix aliasing violation
Search keys and tree entries are non-const.
- - - - -
1cd55cba by Rémi Denis-Courmont at 2022-02-23T19:29:39+00:00
modules: fix aliasing violation
vlc_modcap_cmp() expects pointers to vlc_modcap structures, not to
character string pointers.
Fixes #26642.
- - - - -
2 changed files:
- src/modules/bank.c
- src/modules/modules.h
Changes:
=====================================
src/modules/bank.c
=====================================
@@ -73,7 +73,7 @@ static void vlc_modcap_free(void *data)
static int vlc_module_cmp (const void *a, const void *b)
{
- const module_t *const *ma = a, *const *mb = b;
+ module_t *const *ma = a, *const *mb = b;
/* Note that qsort() uses _ascending_ order,
* so the smallest module is the one with the biggest score. */
return (*mb)->i_score - (*ma)->i_score;
@@ -844,7 +844,12 @@ module_t **module_list_get (size_t *n)
size_t module_list_cap(module_t *const **restrict list, const char *name)
{
- const void **cp = tfind(&name, &modules.caps_tree, vlc_modcap_cmp);
+ vlc_modcap_t key;
+
+ assert(name != NULL);
+ key.name = (char *)name;
+
+ const void **cp = tfind(&key, &modules.caps_tree, vlc_modcap_cmp);
if (cp == NULL)
{
*list = NULL;
=====================================
src/modules/modules.h
=====================================
@@ -121,13 +121,18 @@ void *vlc_plugin_Symbol(struct vlc_logger *, vlc_plugin_t *, const char *name);
/**
* Lists of all VLC modules with a given capability.
*
- * The list is sorted by decreasing module score.
+ * This functions returns a table of all VLC modules whose capability
+ * matches the supplied capability name. Entries are sorted by decreasing
+ * module score.
*
- * @param list pointer to the table of modules [OUT]
- * @param name name of capability of modules to look for
- * @return the number of modules in the list (possibly zero)
+ * \note This function cannot fail. It returns zero if, and only if, no
+ * modules match the requested capability inside the module bank.
+ *
+ * @param tab pointer to the table of modules [OUT]
+ * @param name capability nul-terminated string (cannot be NULL)
+ * @return the number of entries in the table
*/
-size_t module_list_cap(module_t *const **, const char *);
+size_t module_list_cap(module_t *const **tab, const char *name);
int vlc_bindtextdomain (const char *);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a49cca05d381ce6a0371fd1d15f983f2e4a58c04...1cd55cbad268ea90db8028c759fa046c4ffe0800
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a49cca05d381ce6a0371fd1d15f983f2e4a58c04...1cd55cbad268ea90db8028c759fa046c4ffe0800
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list