aboutsummaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-20 20:10:56 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-21 05:57:19 +0200
commit6b969d25ce136eaf695222bd1a10bff1ecac0220 (patch)
treec23afb50c28b9deaddae5c6526a74ee11cf2d865 /src/alloc.c
parentd4bdb8dae753462f621507d5fc3582e0e53da35c (diff)
downloadffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.tar.gz
ffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.zip
all: split Makefile and reorg library/tools
Diffstat (limited to '')
-rw-r--r--libffwd/alloc.c (renamed from src/alloc.c)12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/alloc.c b/libffwd/alloc.c
index 41a59a4..6af854a 100644
--- a/src/alloc.c
+++ b/libffwd/alloc.c
@@ -8,8 +8,8 @@
* growth, never allocate fewer than the minimum, and round up to the
* granularity so small length changes do not trigger a realloc on every call.
* Existing larger capacity is preserved. */
-#define EMBED_MIN_WORKSPACE_SEQ_CAP 16
-#define EMBED_WORKSPACE_SEQ_GRANULARITY 16
+#define FFWD_MIN_WORKSPACE_SEQ_CAP 16
+#define FFWD_WORKSPACE_SEQ_GRANULARITY 16
int mul_size(size_t a, size_t b, size_t *out) {
if (a != 0 && b > SIZE_MAX / a)
@@ -30,12 +30,12 @@ int grow_cap(int current, int needed, int *out) {
return -1;
int cap = needed;
- if (cap < EMBED_MIN_WORKSPACE_SEQ_CAP)
- cap = EMBED_MIN_WORKSPACE_SEQ_CAP;
+ if (cap < FFWD_MIN_WORKSPACE_SEQ_CAP)
+ cap = FFWD_MIN_WORKSPACE_SEQ_CAP;
- int rem = cap % EMBED_WORKSPACE_SEQ_GRANULARITY;
+ int rem = cap % FFWD_WORKSPACE_SEQ_GRANULARITY;
if (rem != 0) {
- int pad = EMBED_WORKSPACE_SEQ_GRANULARITY - rem;
+ int pad = FFWD_WORKSPACE_SEQ_GRANULARITY - rem;
if (cap > INT_MAX - pad)
return -1;
cap += pad;