aboutsummaryrefslogtreecommitdiff
path: root/libffwd/alloc.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-09-29 13:11:00 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-09-29 13:11:00 +0200
commit37cbaef9ceb828c667da8f398027ba5415ee7475 (patch)
tree6103e92a9030766e78a35df00f7a1155d0d0ecf5 /libffwd/alloc.c
parentcf7d8169ec12cb3adf90d4ff78b3257e74985302 (diff)
downloadlangdet-37cbaef9ceb828c667da8f398027ba5415ee7475.tar.gz
langdet-37cbaef9ceb828c667da8f398027ba5415ee7475.zip
Rename CPU library API and sources to langdet
Diffstat (limited to '')
-rw-r--r--liblangdet/alloc.c (renamed from libffwd/alloc.c)12
1 files changed, 6 insertions, 6 deletions
diff --git a/libffwd/alloc.c b/liblangdet/alloc.c
index ba21fbb..4bc1496 100644
--- a/libffwd/alloc.c
+++ b/liblangdet/alloc.c
@@ -9,8 +9,8 @@
* - never allocate less than the minimum required size.
* - round up to the granularity so small length changes do not trigger a realloc on every call.
* - keep existing capacity if it is already larger. */
-#define FFWD_MIN_WORKSPACE_SEQ_CAP 16
-#define FFWD_WORKSPACE_SEQ_GRANULARITY 16
+#define LANGDET_MIN_WORKSPACE_SEQ_CAP 16
+#define LANGDET_WORKSPACE_SEQ_GRANULARITY 16
int mul_size(size_t a, size_t b, size_t *out) {
if (a != 0 && b > SIZE_MAX / a)
@@ -24,12 +24,12 @@ int grow_cap(int current, int needed, int *out) {
return -1;
int cap = needed;
- if (cap < FFWD_MIN_WORKSPACE_SEQ_CAP)
- cap = FFWD_MIN_WORKSPACE_SEQ_CAP;
+ if (cap < LANGDET_MIN_WORKSPACE_SEQ_CAP)
+ cap = LANGDET_MIN_WORKSPACE_SEQ_CAP;
- int rem = cap % FFWD_WORKSPACE_SEQ_GRANULARITY;
+ int rem = cap % LANGDET_WORKSPACE_SEQ_GRANULARITY;
if (rem != 0) {
- int pad = FFWD_WORKSPACE_SEQ_GRANULARITY - rem;
+ int pad = LANGDET_WORKSPACE_SEQ_GRANULARITY - rem;
if (cap > INT_MAX - pad)
return -1;
cap += pad;