[vlc-commits] module_get_capability(): never return NULL

Rémi Denis-Courmont git at videolan.org
Fri Oct 12 18:04:14 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct 12 18:04:58 2012 +0300| [5c843e8bcc5ab08d18281135f3797451b5bab70d] | committer: Rémi Denis-Courmont

module_get_capability(): never return NULL

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5c843e8bcc5ab08d18281135f3797451b5bab70d
---

 src/modules/modules.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index 9adc6cf..ee4e247 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -48,13 +48,11 @@
  *
  * \param m the module
  * \param cap the capability to check
- * \return TRUE if the module have the capability
+ * \return true if the module has the capability
  */
-bool module_provides( const module_t *m, const char *cap )
+bool module_provides (const module_t *m, const char *cap)
 {
-    if (unlikely(m->psz_capability == NULL))
-        return false;
-    return !strcmp( m->psz_capability, cap );
+    return !strcmp (module_get_capability (m), cap);
 }
 
 /**
@@ -99,14 +97,14 @@ const char *module_get_help( const module_t *m )
 }
 
 /**
- * Get the capability for a module
+ * Gets the capability of a module
  *
  * \param m the module
- * return the capability
+ * \return the capability, or "none" if unspecified
  */
-const char *module_get_capability( const module_t *m )
+const char *module_get_capability (const module_t *m)
 {
-    return m->psz_capability;
+    return (m->psz_capability != NULL) ? m->psz_capability : "none";
 }
 
 /**



More information about the vlc-commits mailing list