Addition and use of defines for string capabilities.
These have been placed into a new header (
vlc_module_caps.h), since they have a dual use, being needed both for plugin descriptors (inc. core option set), and module loading (core; lib; plugins). The
vlc_plugin.h header is primarily for the former and is already rather messy, and
vlc_modules.h is for the latter; the defines do not perfectly fit either, and we surely don't really want to force parts of the core to import all of
vlc_plugins.h just to get these defines, nor alternatively do we want to have every plugin including both
vlc_modules.h. With both of those headers importing this new header, everything needing these defines thus gets them via their existing includes of one or both of those headers.
One or two caps might only be used between modules, outside of the core, and perhaps they could get moved at some point to shared plugin headers, but there's no harm in just having them all together for now.
Some benefits worth considering:
- Immediate feedback for typos upon compiling, getting an error.
- Masks the inconsistency issue with spaces vs. underscores.
- Code searches for use of a particular cap/var/obj name are much easier, with fewer false positives.
- Helps avoid mistakes and improves code readability with
add_module[_list]()option definitions, which differ from most in the second param not being the default value param. Sure, testing can help, but people don't always test things, for instance afc593fb was required due to a typo mistake made in 1f5744e9.
- Improved code readability generally, for instance consider
module_need_var()where the last two params are both strings, sometimes even identical. The defines make it immediately clear what is a mod-cap rather than option/variable/object/whatever name.
- It's a crucial component in a type-strict activate/deactivate solution, which helps module authors be confident they have not made mistakes, and helping catch mistakes if/when changes are made, as have been made before. (Prototyping can use the old generic interface).
(Extracted from !61 (closed) after rebasing to come first; split up into multiple commits)