[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / glib / gmem.c
index c17dda4..6a108ee 100644 (file)
@@ -70,7 +70,7 @@ static GMemVTable glib_mem_vtable = {
  * This also means that there is no need to check if the call succeeded.
  * 
  * It's important to match g_malloc() (and wrappers such as g_new()) with
- * g_free(), g_slice_alloc() and wrappers such as g_slice_new()) with
+ * g_free(), g_slice_alloc() (and wrappers such as g_slice_new()) with
  * g_slice_free(), plain malloc() with free(), and (if you're using C++)
  * new with delete and new[] with delete[]. Otherwise bad things can happen,
  * since these allocators may use different memory pools (and new/delete call
@@ -204,9 +204,6 @@ g_free (gpointer mem)
  * Otherwise, the variable is destroyed using @destroy and the
  * pointer is set to %NULL.
  *
- * This function is threadsafe and modifies the pointer atomically,
- * using memory barriers where needed.
- *
  * A macro is also included that allows this function to be used without
  * pointer casts.
  *
@@ -219,15 +216,12 @@ g_clear_pointer (gpointer      *pp,
 {
   gpointer _p;
 
-  /* This is a little frustrating.
-   * Would be nice to have an atomic exchange (with no compare).
-   */
-  do
-    _p = g_atomic_pointer_get (pp);
-  while G_UNLIKELY (!g_atomic_pointer_compare_and_exchange (pp, _p, NULL));
-
+  _p = *pp;
   if (_p)
-    destroy (_p);
+    {
+      *pp = NULL;
+      destroy (_p);
+    }
 }
 
 /**
@@ -481,7 +475,7 @@ static gboolean vtable_set = FALSE;
  *
  * A different allocator can be set using g_mem_set_vtable().
  *
- * Return value: if %TRUE, malloc() and g_malloc() can be mixed.
+ * Returns: if %TRUE, malloc() and g_malloc() can be mixed.
  **/
 gboolean
 g_mem_is_system_malloc (void)