]> git.sesse.net Git - vlc/commitdiff
module_get_capability(): never return NULL
authorRémi Denis-Courmont <remi@remlab.net>
Fri, 12 Oct 2012 15:04:58 +0000 (18:04 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Fri, 12 Oct 2012 16:03:58 +0000 (19:03 +0300)
src/modules/modules.c

index 9adc6cf331f26e5c32b87a23c87bc2167b9328ea..ee4e24751d24dfc4dbaa0627f7a5747a26c7cf0b 100644 (file)
  *
  * \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";
 }
 
 /**