[vlc-commits] tls: remove useless module pointer

Rémi Denis-Courmont git at videolan.org
Sun Nov 18 16:57:22 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 18 14:16:43 2018 +0200| [ff5e497aaadf73aaa853bfe88f1a5204750d8867] | committer: Rémi Denis-Courmont

tls: remove useless module pointer

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

 include/vlc_tls.h |  1 -
 src/network/tls.c | 20 +++++---------------
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/include/vlc_tls.h b/include/vlc_tls.h
index 08772cbced..66683cea35 100644
--- a/include/vlc_tls.h
+++ b/include/vlc_tls.h
@@ -139,7 +139,6 @@ typedef struct vlc_tls_creds
 {
     struct vlc_common_members obj;
 
-    module_t *module;
     void *sys;
 
     vlc_tls_t *(*open)(struct vlc_tls_creds *, vlc_tls_t *sock,
diff --git a/src/network/tls.c b/src/network/tls.c
index c2bb88585c..5b86f00718 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -65,14 +65,6 @@ static int tls_client_load(void *func, va_list ap)
     return activate (crd);
 }
 
-static void tls_unload(void *func, va_list ap)
-{
-    void (*deactivate) (vlc_tls_creds_t *) = func;
-    vlc_tls_creds_t *crd = va_arg (ap, vlc_tls_creds_t *);
-
-    deactivate (crd);
-}
-
 vlc_tls_creds_t *
 vlc_tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
                       const char *key_path)
@@ -85,9 +77,8 @@ vlc_tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
     if (key_path == NULL)
         key_path = cert_path;
 
-    srv->module = vlc_module_load (srv, "tls server", NULL, false,
-                                   tls_server_load, srv, cert_path, key_path);
-    if (srv->module == NULL)
+    if (vlc_module_load(srv, "tls server", NULL, false,
+                        tls_server_load, srv, cert_path, key_path) == NULL)
     {
         msg_Err (srv, "TLS server plugin not available");
         vlc_object_release (srv);
@@ -104,9 +95,8 @@ vlc_tls_creds_t *vlc_tls_ClientCreate (vlc_object_t *obj)
     if (unlikely(crd == NULL))
         return NULL;
 
-    crd->module = vlc_module_load (crd, "tls client", NULL, false,
-                                   tls_client_load, crd);
-    if (crd->module == NULL)
+    if (vlc_module_load(crd, "tls client", NULL, false,
+                        tls_client_load, crd) == NULL)
     {
         msg_Err (crd, "TLS client plugin not available");
         vlc_object_release (crd);
@@ -122,7 +112,7 @@ void vlc_tls_Delete (vlc_tls_creds_t *crd)
         return;
 
     crd->destroy(crd);
-    vlc_module_unload(crd, crd->module, tls_unload, crd);
+    vlc_objres_clear(VLC_OBJECT(crd));
     vlc_object_release (crd);
 }
 



More information about the vlc-commits mailing list