aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-09-14 11:03:27 +0200
committerlemon <lsof@mailbox.org>2025-09-14 11:03:27 +0200
commita95e385217841da91c3e44674dbaa95fb613a153 (patch)
treea241ddf7c0b83fff1e45ccdf7feabaded9e4ed8d /common.h
parent0ca9f9fec545c6c73f9dae24c68271d792906a62 (diff)
change freearena for correctness
Diffstat (limited to 'common.h')
-rw-r--r--common.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/common.h b/common.h
index 6c2e1e9..7848fa1 100644
--- a/common.h
+++ b/common.h
@@ -344,8 +344,9 @@ struct arena {
#define vec_of(T) struct { T *p; int _cap; uint n; }
/* libc *alloc wrappers */
-extern void *xcalloc(size_t n, const char *);
-extern void *xrealloc(void *, size_t n, const char *);
+void *xcalloc(size_t n, const char *);
+void *xrealloc(void *, size_t n, const char *);
+void free(void *);
#define xcalloc(n) xcalloc(n, __func__)
#define xrealloc(p,n) xrealloc(p, n, __func__)
@@ -383,13 +384,12 @@ alloccopy(struct arena **arena, const void *src, uint siz, uint align)
{
return memcpy(alloc(arena, siz, align), src, siz);
}
-void freearena(struct arena *);
+void freearena(struct arena **);
void vinit_(void **p, int *pcap, void *inlbuf, int cap, uint siz);
void vpush_(void **p, int *pcap, uint *pn, uint siz);
void *vpushn_(void **p, int *pcap, uint *pn, uint siz, const void *dat, uint ndat);
void vresize_(void **p, int *pcap, uint *pn, uint siz, uint N);
-extern void free(void *);
#define VINIT(inlbuf, Cap) { (inlbuf), (Cap) }
#define vfree(v) ((v)->_cap < 0 ? free((v)->p) : (void)0, memset((v), 0, sizeof*(v)))
#define vinit(v, inlbuf, Cap) (vfree(v), vinit_((void **)&(v)->p, &(v)->_cap, inlbuf, (Cap), sizeof *(v)->p))