[glib] GHashTable: statically assert that GHashTableIter works as intended



commit a4480d5f715a7631b1e98daa08a447f7c6b4bcd1
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Fri Nov 16 12:51:31 2012 +0000

    GHashTable: statically assert that GHashTableIter works as intended
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688406

 glib/ghash.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index 14d0fda..256c843 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -34,6 +34,7 @@
 
 #include "ghash.h"
 
+#include "glib-private.h"
 #include "gstrfuncs.h"
 #include "gatomic.h"
 #include "gtestutils.h"
@@ -246,6 +247,9 @@ typedef struct
   int          version;
 } RealIter;
 
+G_STATIC_ASSERT (sizeof (GHashTableIter) == sizeof (RealIter));
+G_STATIC_ASSERT (_g_alignof (GHashTableIter) >= _g_alignof (RealIter));
+
 /* Each table size has an associated prime modulo (the first prime
  * lower than the table size) used to find the initial bucket. Probing
  * then works modulo 2^n. The prime modulo is necessary to get a


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