[vlc-commits] messages: simplify vlc_LogDeinit()
Rémi Denis-Courmont
git at videolan.org
Wed Feb 20 16:36:08 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 19 19:13:36 2019 +0200| [91743e4de734d5a0a9512db83d138c4d1268f9c2] | committer: Rémi Denis-Courmont
messages: simplify vlc_LogDeinit()
In the final deinitialization, there is no thread safety and
logger replacement. The existing logger is simply deleted.
Also rename it to vlc_LogDestroy() and take a logger pointer rather
than the VLC instance.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91743e4de734d5a0a9512db83d138c4d1268f9c2
---
src/libvlc.c | 2 +-
src/libvlc.h | 6 +++++-
src/misc/messages.c | 6 +++---
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/libvlc.c b/src/libvlc.c
index 1ef103085c..f183d3e978 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -479,8 +479,8 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
if( !var_InheritBool( p_libvlc, "ignore-config" ) )
config_AutoSaveConfigFile( VLC_OBJECT(p_libvlc) );
+ vlc_LogDestroy(priv->logger);
/* Free module bank. It is refcounted, so we call this each time */
- vlc_LogDeinit (p_libvlc);
module_EndBank (true);
#if defined(_WIN32) || defined(__OS2__)
system_End( );
diff --git a/src/libvlc.h b/src/libvlc.h
index 209a4bc9d3..e692ede7b4 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -79,7 +79,11 @@ typedef struct vlc_logger_t vlc_logger_t;
int vlc_LogPreinit(libvlc_int_t *) VLC_USED;
void vlc_LogInit(libvlc_int_t *);
-void vlc_LogDeinit(libvlc_int_t *);
+
+/**
+ * Destroys a message log.
+ */
+void vlc_LogDestroy(vlc_logger_t *);
/*
* LibVLC exit event handling
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 97f900ad18..8fbcfcf377 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -403,11 +403,11 @@ void vlc_LogSet(libvlc_int_t *vlc, const struct vlc_logger_operations *ops,
msg_Dbg (vlc, "configured with %s", CONFIGURE_LINE);
}
-void vlc_LogDeinit(libvlc_int_t *vlc)
+void vlc_LogDestroy(vlc_logger_t *logger)
{
- vlc_logger_t *logger = libvlc_priv(vlc)->logger;
+ if (logger->ops->destroy != NULL)
+ logger->ops->destroy(logger->sys);
- vlc_LogSwitch(vlc, NULL, NULL);
vlc_rwlock_destroy(&logger->lock);
vlc_object_release(logger);
}
More information about the vlc-commits
mailing list