GTree: Add a G_STATIC_ASSERT for MAX_GTREE_HEIGHT

Makes sure we don't accidentally set it too small and overflow a tree path
array.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
This commit is contained in:
Maciej S. Szmigiero 2023-08-08 16:06:20 +02:00
parent f08191e398
commit faa11d0910

View File

@ -69,6 +69,8 @@
**/ **/
#define MAX_GTREE_HEIGHT 40 #define MAX_GTREE_HEIGHT 40
/* G_MAXUINT nodes will be covered by tree height of log2(G_MAXUINT) + 2. */
G_STATIC_ASSERT ((G_GUINT64_CONSTANT (1) << (MAX_GTREE_HEIGHT - 2)) >= G_MAXUINT);
/** /**
* GTree: * GTree: