[vlc-commits] msg_...: accept filename as module

Rémi Denis-Courmont git at videolan.org
Sun Sep 15 19:38:53 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 15 17:04:02 2013 +0300| [5007283a1801920f54dfebeeb2548b273282475d] | committer: Rémi Denis-Courmont

msg_...: accept filename as module

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

 src/misc/messages.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index cc91a66..573a96a 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -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);



More information about the vlc-commits mailing list