[glib: 1/2] gmodule: change _g_module_close to only take a handle.



commit 62f6c80e63725405f7d753d475dd25d2460dd547
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Sep 14 10:32:54 2018 +0100

    gmodule: change _g_module_close to only take a handle.
    
    Since is_unref |= 1, the second argument, gboolean is_unref, has had
    no effect.

 gmodule/gmodule-ar.c    | 15 +++------------
 gmodule/gmodule-dl.c    | 14 ++------------
 gmodule/gmodule-win32.c |  3 +--
 gmodule/gmodule.c       | 10 ++++------
 4 files changed, 10 insertions(+), 32 deletions(-)
---
diff --git a/gmodule/gmodule-ar.c b/gmodule/gmodule-ar.c
index 3301c474f..381eef4db 100644
--- a/gmodule/gmodule-ar.c
+++ b/gmodule/gmodule-ar.c
@@ -141,19 +141,10 @@ _g_module_self (void)
 }
 
 static void
-_g_module_close (gpointer handle,
-                gboolean is_unref)
+_g_module_close (gpointer handle)
 {
-  /* are there any systems out there that have dlopen()/dlclose()
-   * without a reference count implementation?
-   */
-  is_unref |= 1;
-  
-  if (is_unref)
-    {
-      if (dlclose (handle) != 0)
-       g_module_set_error (fetch_dlerror (TRUE));
-    }
+  if (dlclose (handle) != 0)
+    g_module_set_error (fetch_dlerror (TRUE));
 }
 
 static gpointer
diff --git a/gmodule/gmodule-dl.c b/gmodule/gmodule-dl.c
index 5d0200c9d..fab151370 100644
--- a/gmodule/gmodule-dl.c
+++ b/gmodule/gmodule-dl.c
@@ -131,21 +131,11 @@ _g_module_self (void)
 }
 
 static void
-_g_module_close (gpointer handle,
-                gboolean is_unref)
+_g_module_close (gpointer handle)
 {
-  /* are there any systems out there that have dlopen()/dlclose()
-   * without a reference count implementation?
-   *
-   * See above for the Android special case
-   */
 #if defined(__BIONIC__)
-  is_unref = (handle != RTLD_DEFAULT);
-#else
-  is_unref |= 1;
+  if (handle != RTLD_DEFAULT)
 #endif
-
-  if (is_unref)
     {
       if (dlclose (handle) != 0)
        g_module_set_error (fetch_dlerror (TRUE));
diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c
index 795dc0938..5057d256e 100644
--- a/gmodule/gmodule-win32.c
+++ b/gmodule/gmodule-win32.c
@@ -113,8 +113,7 @@ _g_module_self (void)
 }
 
 static void
-_g_module_close (gpointer handle,
-                gboolean is_unref)
+_g_module_close (gpointer handle)
 {
   if (handle != null_module_handle)
     if (!FreeLibrary (handle))
diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c
index 744abe0ac..e71b07e48 100644
--- a/gmodule/gmodule.c
+++ b/gmodule/gmodule.c
@@ -207,8 +207,7 @@ struct _GModule
 static gpointer                _g_module_open          (const gchar    *file_name,
                                                 gboolean        bind_lazy,
                                                 gboolean        bind_local);
-static void            _g_module_close         (gpointer        handle,
-                                                gboolean        is_unref);
+static void            _g_module_close         (gpointer        handle);
 static gpointer                _g_module_self          (void);
 static gpointer                _g_module_symbol        (gpointer        handle,
                                                 const gchar    *symbol_name);
@@ -297,8 +296,7 @@ _g_module_open (const gchar *file_name,
   return NULL;
 }
 static void
-_g_module_close        (gpointer        handle,
-                gboolean        is_unref)
+_g_module_close (gpointer handle)
 {
 }
 static gpointer
@@ -615,7 +613,7 @@ g_module_open (const gchar    *file_name,
       module = g_module_find_by_handle (handle);
       if (module)
        {
-         _g_module_close (module->handle, TRUE);
+         _g_module_close (module->handle);
          module->ref_count++;
          g_module_set_error (NULL);
          
@@ -721,7 +719,7 @@ g_module_close (GModule *module)
        }
       module->next = NULL;
       
-      _g_module_close (module->handle, FALSE);
+      _g_module_close (module->handle);
       g_free (module->file_name);
       g_free (module);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]