From 3929ddedca049ac6f9dcbe88f85233b6ec1a415a Mon Sep 17 00:00:00 2001
From: Tavian Barnes <tavianator@tavianator.com>
Date: Wed, 10 May 2023 15:43:31 -0400
Subject: config: s/BFS_FLEX_SIZEOF/flex_sizeof/

---
 src/bftw.c    | 2 +-
 src/config.h  | 4 ++--
 src/dstring.c | 2 +-
 src/trie.c    | 4 ++--
 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__
-- 
cgit v1.2.3