summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-05-21 22:41:50 +0200
committerLouis Burda <quent.burda@gmail.com>2023-05-21 22:41:50 +0200
commita53bb631112fc7ad0553bd5ac86dbfacb0d378e0 (patch)
treeef4a78bdd642d4812c6a42a45c44dd89af70809a
parent6d7aef62de3dd6a5900816b002bf9304d763e052 (diff)
downloadlibstrvec-c-a53bb631112fc7ad0553bd5ac86dbfacb0d378e0.tar.gz
libstrvec-c-a53bb631112fc7ad0553bd5ac86dbfacb0d378e0.zip
Use const allocator pointer args
-rw-r--r--include/strvec.h6
-rw-r--r--src/strvec.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/include/strvec.h b/include/strvec.h
index a7f622c..b28980e 100644
--- a/include/strvec.h
+++ b/include/strvec.h
@@ -26,10 +26,12 @@ struct strvec {
struct dvec vec;
};
-int strvec_init(struct strvec *strvec, size_t cap, struct allocator *allocator);
+int strvec_init(struct strvec *strvec, size_t cap,
+ const struct allocator *allocator);
int strvec_deinit(struct strvec *strvec);
-struct strvec *strvec_alloc(size_t reserved, struct allocator *allocator, int *rc);
+struct strvec *strvec_alloc(size_t reserved,
+ const struct allocator *allocator, int *rc);
int strvec_free(struct strvec *strvec);
int strvec_copy(struct strvec *dst, struct strvec *src,
diff --git a/src/strvec.c b/src/strvec.c
index 7073edf..296dccf 100644
--- a/src/strvec.c
+++ b/src/strvec.c
@@ -5,7 +5,8 @@
#include <string.h>
int
-strvec_init(struct strvec *strvec, size_t cap, struct allocator *allocator)
+strvec_init(struct strvec *strvec, size_t cap,
+ const struct allocator *allocator)
{
int rc;
@@ -31,7 +32,7 @@ strvec_deinit(struct strvec *strvec)
}
struct strvec *
-strvec_alloc(size_t cap, struct allocator *allocator, int *_rc)
+strvec_alloc(size_t cap, const struct allocator *allocator, int *_rc)
{
struct strvec *strvec;
int *rc, stub;