summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bftw.c2
-rw-r--r--src/config.h4
-rw-r--r--src/dstring.c2
-rw-r--r--src/trie.c4
4 files changed, 6 insertions, 6 deletions
diff --git a/src/bftw.c b/src/bftw.c
index e4dc411..d2f1e36 100644
--- a/src/bftw.c
+++ b/src/bftw.c
@@ -178,7 +178,7 @@ static void bftw_cache_destroy(struct bftw_cache *cache) {
/** Create a new bftw_file. */
static struct bftw_file *bftw_file_new(struct bftw_file *parent, const char *name) {
size_t namelen = strlen(name);
- size_t size = BFS_FLEX_SIZEOF(struct bftw_file, name, namelen + 1);
+ size_t size = flex_sizeof(struct bftw_file, name, namelen + 1);
struct bftw_file *file = malloc(size);
if (!file) {
diff --git a/src/config.h b/src/config.h
index 60bc930..aa54491 100644
--- a/src/config.h
+++ b/src/config.h
@@ -136,7 +136,7 @@
*/
#define countof(array) (sizeof(array) / sizeof(0[array]))
-// Lower bound on BFS_FLEX_SIZEOF()
+// Lower bound on flex_sizeof()
#define BFS_FLEX_LB(type, member, length) (offsetof(type, member) + sizeof(((type *)NULL)->member[0]) * (length))
// Maximum macro for BFS_FLEX_SIZE()
@@ -153,7 +153,7 @@
* @param length
* The length of the flexible array.
*/
-#define BFS_FLEX_SIZEOF(type, member, length) \
+#define flex_sizeof(type, member, length) \
(sizeof(type) <= BFS_FLEX_LB(type, member, 0) \
? BFS_FLEX_LB(type, member, length) \
: BFS_FLEX_MAX(sizeof(type), BFS_FLEX_LB(type, member, length)))
diff --git a/src/dstring.c b/src/dstring.c
index 9112e54..05efb10 100644
--- a/src/dstring.c
+++ b/src/dstring.c
@@ -24,7 +24,7 @@ static struct dstring *dstrheader(const char *dstr) {
/** Get the correct size for a dstring with the given capacity. */
static size_t dstrsize(size_t capacity) {
- return BFS_FLEX_SIZEOF(struct dstring, data, capacity + 1);
+ return flex_sizeof(struct dstring, data, capacity + 1);
}
/** Allocate a dstring with the given contents. */
diff --git a/src/trie.c b/src/trie.c
index 9f2e45f..bfe97e6 100644
--- a/src/trie.c
+++ b/src/trie.c
@@ -336,7 +336,7 @@ struct trie_leaf *trie_find_prefix(const struct trie *trie, const char *key) {
/** Create a new leaf, holding a copy of the given key. */
static struct trie_leaf *trie_leaf_alloc(struct trie *trie, const void *key, size_t length) {
- struct trie_leaf *leaf = malloc(BFS_FLEX_SIZEOF(struct trie_leaf, key, length));
+ struct trie_leaf *leaf = malloc(flex_sizeof(struct trie_leaf, key, length));
if (!leaf) {
return NULL;
}
@@ -363,7 +363,7 @@ static size_t trie_node_size(unsigned int size) {
// Node size must be a power of two
assert(is_power_of_two(size));
- return BFS_FLEX_SIZEOF(struct trie_node, children, size);
+ return flex_sizeof(struct trie_node, children, size);
}
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__