GHashTable: statically assert that GHashTableIter works as intended

https://bugzilla.gnome.org/show_bug.cgi?id=688406
This commit is contained in:
Simon McVittie 2012-11-16 12:51:31 +00:00 committed by Matthias Clasen
parent 476aa9ae46
commit a4480d5f71

View 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