From: Simon McVittie Date: Fri, 16 Nov 2012 12:51:31 +0000 (+0000) Subject: GHashTable: statically assert that GHashTableIter works as intended X-Git-Tag: 2.39.4~110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4480d5f715a7631b1e98daa08a447f7c6b4bcd1;p=platform%2Fupstream%2Fglib.git GHashTable: statically assert that GHashTableIter works as intended https://bugzilla.gnome.org/show_bug.cgi?id=688406 --- 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