From: RĂ©mi Denis-Courmont Date: Sun, 15 Sep 2013 14:04:02 +0000 (+0300) Subject: msg_...: accept filename as module X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=5007283a1801920f54dfebeeb2548b273282475d;p=vlc msg_...: accept filename as module --- diff --git a/src/misc/messages.c b/src/misc/messages.c index cc91a662fa..573a96a294 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);