GHashTable: statically assert that GHashTableIter works as intended
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 16 Nov 2012 12:51:31 +0000 (12:51 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 20 Jan 2014 01:23:43 +0000 (20:23 -0500)
https://bugzilla.gnome.org/show_bug.cgi?id=688406

glib/ghash.c

index 14d0fda..256c843 100644 (file)
@@ -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