[BACK]Return to patch-glib_tests_hash.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / devel / glib2 / patches

File: [cvs.NetBSD.org] / pkgsrc / devel / glib2 / patches / patch-glib_tests_hash.c (download)

Revision 1.2, Sun Dec 29 19:40:56 2019 UTC (2 months, 4 weeks ago) by triaxx
Branch: MAIN
Changes since 1.1: +6 -6 lines

glib2: update to 2.62.4

pkgsrc changes:
---------------
  * Fix build on FreeBSD (PR 54752)

upstream changes:
-----------------
  * Apply recursion depth limits to variants in D-Bus messages (!1290)
  * Bugs fixed:
      o #1938 GDateTime doesn't support leap seconds
      o !1240 Backport !1233 ◊»datetime: Handle leap seconds in ISO8601 dates„ŗto glib-2-62
      o !1257 Backport !1232 „ŗ◊Őqueue: Do not return early from _kqsub_cancel„ŗto glib-2-62
      o !1266 Backport !1265 „ŗ◊√uild: don't check for protected visibility„ŗto glib-2-62
      o !1276 Backport !1274 „ŗ◊’rash portal: Don't follow symlinks„ŗto glib-2-62
      o !1290 Backport !1201 „ŗ◊»dbusmessage: Limit recursion of variants in D-Bus messages„ŗto glib-2-62

$NetBSD: patch-glib_tests_hash.c,v 1.2 2019/12/29 19:40:56 triaxx Exp $

Revert GHashTable improvements
https://gitlab.gnome.org/GNOME/glib/merge_requests/208

to fix PR pkg/54310

--- glib/tests/hash.c.orig	2019-12-19 16:33:15.000000000 +0000
+++ glib/tests/hash.c
@@ -1353,9 +1353,6 @@ struct _GHashTable
   gint             nnodes;
   gint             noccupied;  /* nnodes + tombstones */
 
-  guint            have_big_keys : 1;
-  guint            have_big_values : 1;
-
   gpointer        *keys;
   guint           *hashes;
   gpointer        *values;
@@ -1390,23 +1387,6 @@ count_keys (GHashTable *h, gint *unused, gint *occupie
     }
 }
 
-#define BIG_ENTRY_SIZE (SIZEOF_VOID_P)
-#define SMALL_ENTRY_SIZE (SIZEOF_INT)
-
-#if SMALL_ENTRY_SIZE < BIG_ENTRY_SIZE
-# define USE_SMALL_ARRAYS
-#endif
-
-static gpointer
-fetch_key_or_value (gpointer a, guint index, gboolean is_big)
-{
-#ifdef USE_SMALL_ARRAYS
-  return is_big ? *(((gpointer *) a) + index) : GUINT_TO_POINTER (*(((guint *) a) + index));
-#else
-  return *(((gpointer *) a) + index);
-#endif
-}
-
 static void
 check_data (GHashTable *h)
 {
@@ -1414,9 +1394,14 @@ check_data (GHashTable *h)
 
   for (i = 0; i < h->size; i++)
     {
-      if (h->hashes[i] >= 2)
+      if (h->hashes[i] < 2)
         {
-          g_assert_cmpint (h->hashes[i], ==, h->hash_func (fetch_key_or_value (h->keys, i, h->have_big_keys)));
+          g_assert (h->keys[i] == NULL);
+          g_assert (h->values[i] == NULL);
+        }
+      else
+        {
+          g_assert_cmpint (h->hashes[i], ==, h->hash_func (h->keys[i]));
         }
     }
 }