]> git.sesse.net Git - vlc/commitdiff
msg_...: accept filename as module
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 15 Sep 2013 14:04:02 +0000 (17:04 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 15 Sep 2013 17:38:41 +0000 (20:38 +0300)
src/misc/messages.c

index cc91a662fad795514554cf29fa88532401b015c6..573a96a29483fbab63b72dc0af6b557c6b0c9bd2 100644 (file)
@@ -84,6 +84,21 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
     if (obj != NULL && obj->i_flags & OBJECT_FLAGS_QUIET)
         return;
 
+    /* Get basename from the module filename */
+    char *p = strrchr(module, '/');
+    if (p != NULL)
+        module = p;
+    p = strchr(module, '.');
+
+    size_t modlen = (p != NULL) ? (p - module) : 1;
+    char modulebuf[modlen];
+    if (p != NULL)
+    {
+        memcpy(modulebuf, module, modlen);
+        modulebuf[modlen] = '\0';
+        module = modulebuf;
+    }
+
     /* C locale to get error messages in English in the logs */
     locale_t c = newlocale (LC_MESSAGES_MASK, "C", (locale_t)0);
     locale_t locale = uselocale (c);