summaryrefslogtreecommitdiffstats
path: root/zix
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-11 17:44:24 +0100
committerDavid Robillard <d@drobilla.net>2020-11-11 22:01:05 +0100
commit86e4ecb99fa626a389cee96fb034c8c5b1c0121b (patch)
tree861ac8671a7726edf988ed8693544c0e3a3fe9ff /zix
parent37727929bb07aec91038a9e4d14dc5a9290a9df5 (diff)
downloadzix-86e4ecb99fa626a389cee96fb034c8c5b1c0121b.tar.gz
zix-86e4ecb99fa626a389cee96fb034c8c5b1c0121b.tar.bz2
zix-86e4ecb99fa626a389cee96fb034c8c5b1c0121b.zip
Use C11 if possible
Diffstat (limited to 'zix')
-rw-r--r--zix/btree.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/zix/btree.c b/zix/btree.c
index 3dc2d57..302ab87 100644
--- a/zix/btree.c
+++ b/zix/btree.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011-2019 David Robillard <http://drobilla.net>
+ Copyright 2011-2020 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -49,6 +49,11 @@ struct ZixBTreeNodeImpl {
ZixBTreeNode* children[ZIX_BTREE_INODE_VALS + 1]; // Nonexistent for leaves
};
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112l) || \
+ (defined(__cplusplus) && __cplusplus >= 201103L)
+static_assert(sizeof(ZixBTreeNode) == ZIX_BTREE_PAGE_SIZE, "");
+#endif
+
typedef struct {
ZixBTreeNode* node;
unsigned index;
@@ -99,7 +104,11 @@ print_tree(const ZixBTreeNode* parent, const ZixBTreeNode* node, int level)
ZIX_PRIVATE ZixBTreeNode*
zix_btree_node_new(const bool leaf)
{
+#if !((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112l) || \
+ (defined(__cplusplus) && __cplusplus >= 201103L))
assert(sizeof(ZixBTreeNode) == ZIX_BTREE_PAGE_SIZE);
+#endif
+
ZixBTreeNode* node = (ZixBTreeNode*)malloc(sizeof(ZixBTreeNode));
if (node) {
node->is_leaf = leaf;