From be64571b0ec136fa785f02acca555e2f03dbd02d Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 31 Mar 2024 17:29:23 +0100 Subject: [PATCH] Pass allocator as const * --- dstr/include/dstr.h | 4 ++-- dstr/src/dstr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dstr/include/dstr.h b/dstr/include/dstr.h index fb46bc2..4e340ae 100644 --- a/dstr/include/dstr.h +++ b/dstr/include/dstr.h @@ -10,8 +10,8 @@ extern "C" { typedef struct dstr String; -String *wapp_dstr_with_capacity(u64 capacity, Allocator *allocator); -String *wapp_dstr_from_string(const char *str, Allocator *allocator); +String *wapp_dstr_with_capacity(u64 capacity, const Allocator *allocator); +String *wapp_dstr_from_string(const char *str, const Allocator *allocator); void wapp_dstr_update(String **dst, const char *src); void wapp_dstr_free(String **str); void wapp_dstr_concat(String **dst, const char *src); diff --git a/dstr/src/dstr.c b/dstr/src/dstr.c index 6b5f4ef..50e60b6 100644 --- a/dstr/src/dstr.c +++ b/dstr/src/dstr.c @@ -17,7 +17,7 @@ struct dstr { char buf[]; }; -String *wapp_dstr_with_capacity(u64 capacity, Allocator *allocator) { +String *wapp_dstr_with_capacity(u64 capacity, const Allocator *allocator) { Allocator alloc; if (allocator) { alloc = *allocator; @@ -38,7 +38,7 @@ String *wapp_dstr_with_capacity(u64 capacity, Allocator *allocator) { return out; } -String *wapp_dstr_from_string(const char *str, Allocator *allocator) { +String *wapp_dstr_from_string(const char *str, const Allocator *allocator) { if (!str) { return NULL; }