[glib/wip/gcleanup: 12/21] gthread: Remove g_private_reset()



commit d7722ea4e46847ae50343921aab86325425935e4
Author: Stef Walter <stefw gnome org>
Date:   Thu Oct 31 14:22:33 2013 +0100

    gthread: Remove g_private_reset()
    
    It's not necessary now that we're doing 3 cleanup passes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=627423

 glib/gcharset.c      |    2 --
 glib/gconvert.c      |    1 -
 glib/gmain.c         |    1 -
 glib/gslice.c        |    1 -
 glib/gthread-posix.c |   25 -------------------------
 glib/gthread.c       |    1 -
 glib/gthread.h       |    2 --
 7 files changed, 0 insertions(+), 33 deletions(-)
---
diff --git a/glib/gcharset.c b/glib/gcharset.c
index 013b8be..62aa566 100644
--- a/glib/gcharset.c
+++ b/glib/gcharset.c
@@ -187,7 +187,6 @@ g_get_charset (const char **charset)
   if (!cache)
     {
       cache = g_new0 (GCharsetCache, 1);
-      G_CLEANUP_ADD (&cache_private, g_private_reset);
       g_private_set (&cache_private, cache);
     }
 
@@ -566,7 +565,6 @@ g_get_language_names (void)
   if (!cache)
     {
       cache = g_new0 (GLanguageNamesCache, 1);
-      G_CLEANUP_ADD (&cache_private, g_private_reset);
       g_private_set (&cache_private, cache);
     }
 
diff --git a/glib/gconvert.c b/glib/gconvert.c
index 74284fe..0382eed 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -1024,7 +1024,6 @@ g_get_filename_charsets (const gchar ***filename_charsets)
   if (!cache)
     {
       cache = g_new0 (GFilenameCharsetCache, 1);
-      G_CLEANUP_ADD (&cache_private, g_private_reset);
       g_private_set (&cache_private, cache);
     }
 
diff --git a/glib/gmain.c b/glib/gmain.c
index 6dcde50..2205e49 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -2722,7 +2722,6 @@ get_dispatch (void)
   if (!dispatch)
     {
       dispatch = g_slice_new0 (GMainDispatch);
-      G_CLEANUP_ADD (&depth_private, g_private_reset);
       g_private_set (&depth_private, dispatch);
     }
 
diff --git a/glib/gslice.c b/glib/gslice.c
index b252806..7bd8218 100644
--- a/glib/gslice.c
+++ b/glib/gslice.c
@@ -524,7 +524,6 @@ thread_memory_from_self (void)
       tmem = g_malloc0 (sizeof (ThreadMemory) + sizeof (Magazine) * 2 * n_magazines);
       tmem->magazine1 = (Magazine*) (tmem + 1);
       tmem->magazine2 = &tmem->magazine1[n_magazines];
-      G_CLEANUP_ADD (&private_thread_memory, g_private_reset);
       g_private_set (&private_thread_memory, tmem);
     }
   return tmem;
diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c
index d5b9a2e..8803218 100644
--- a/glib/gthread-posix.c
+++ b/glib/gthread-posix.c
@@ -1127,31 +1127,6 @@ g_private_replace (GPrivate *key,
     g_thread_abort (status, "pthread_setspecific");
 }
 
-/**
- * g_private_reset:
- * @key: a #GPrivate
- *
- * Unsets the thread local variable @key to have the value @value in the
- * current thread.  If the previous value was non-%NULL then the
- * #GDestroyNotify handler for @key is run on it.
- *
- * Since: 2.32
- **/
-void
-g_private_reset (GPrivate *key)
-{
-  pthread_key_t *impl = g_private_get_impl (key);
-  gpointer old;
-  gint status;
-
-  old = pthread_getspecific (*impl);
-  if (old && key->notify)
-    key->notify (old);
-
-  if G_UNLIKELY ((status = pthread_setspecific (*impl, NULL)) != 0)
-    g_thread_abort (status, "pthread_setspecific");
-}
-
 /* {{{1 GThread */
 
 #define posix_check_err(err, name) G_STMT_START{                       \
diff --git a/glib/gthread.c b/glib/gthread.c
index be9f74b..141ab7e 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -1003,7 +1003,6 @@ g_thread_self (void)
       thread = g_slice_new0 (GRealThread);
       thread->ref_count = 1;
 
-      G_CLEANUP_ADD (&g_thread_specific_private, g_private_reset);
       g_private_set (&g_thread_specific_private, thread);
     }
 
diff --git a/glib/gthread.h b/glib/gthread.h
index a4a0030..43c7891 100644
--- a/glib/gthread.h
+++ b/glib/gthread.h
@@ -224,8 +224,6 @@ void            g_private_set                   (GPrivate       *key,
 GLIB_AVAILABLE_IN_2_32
 void            g_private_replace               (GPrivate       *key,
                                                  gpointer        value);
-GLIB_AVAILABLE_IN_2_36
-void            g_private_reset                 (GPrivate       *key);
 
 GLIB_AVAILABLE_IN_ALL
 gpointer        g_once_impl                     (GOnce          *once,


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