[vlc-commits] messages: pass logger rather than VLC instance

Rémi Denis-Courmont git at videolan.org
Tue Feb 19 21:50:51 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 19 18:45:36 2019 +0200| [4d8cb8f201e00b43a64405f0deafb463a3defe42] | committer: Rémi Denis-Courmont

messages: pass logger rather than VLC instance

No functional changes.

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

 src/misc/messages.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index 1c02c232a2..97f900ad18 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -50,11 +50,10 @@ struct vlc_logger_t
     void *sys;
 };
 
-static void vlc_vaLogCallback(libvlc_int_t *vlc, int type,
+static void vlc_vaLogCallback(vlc_logger_t *logger, int type,
                               const vlc_log_t *item, const char *format,
                               va_list ap)
 {
-    vlc_logger_t *logger = libvlc_priv(vlc)->logger;
     int canc;
 
     assert(logger != NULL);
@@ -65,13 +64,13 @@ static void vlc_vaLogCallback(libvlc_int_t *vlc, int type,
     vlc_restorecancel(canc);
 }
 
-static void vlc_LogCallback(libvlc_int_t *vlc, int type, const vlc_log_t *item,
-                            const char *format, ...)
+static void vlc_LogCallback(vlc_logger_t *logger, int type,
+                            const vlc_log_t *item, const char *format, ...)
 {
     va_list ap;
 
     va_start(ap, format);
-    vlc_vaLogCallback(vlc, type, item, format, ap);
+    vlc_vaLogCallback(logger, type, item, format, ap);
     va_end(ap);
 }
 
@@ -134,8 +133,11 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
 #endif
 
     /* Pass message to the callback */
-    if (obj != NULL)
-        vlc_vaLogCallback(vlc_object_instance(obj), type, &msg, format, args);
+    if (obj != NULL) {
+        vlc_logger_t *logger = libvlc_priv(vlc_object_instance(obj))->logger;
+
+        vlc_vaLogCallback(logger, type, &msg, format, args);
+    }
 }
 
 /**
@@ -254,12 +256,11 @@ static void vlc_LogEarlyClose(void *d)
 {
     vlc_logger_early_t *sys = d;
     vlc_logger_t *logger = sys->sink;
-    libvlc_int_t *vlc = vlc_object_instance(logger);
 
     /* Drain early log messages */
     for (vlc_log_early_t *log = sys->head, *next; log != NULL; log = next)
     {
-        vlc_LogCallback(vlc, log->type, &log->meta, "%s",
+        vlc_LogCallback(logger, log->type, &log->meta, "%s",
                         (log->msg != NULL) ? log->msg : "message lost");
         free(log->msg);
         next = log->next;



More information about the vlc-commits mailing list