aboutsummaryrefslogtreecommitdiff
path: root/sys/libn/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/libn/memory.c')
-rw-r--r--sys/libn/memory.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/libn/memory.c b/sys/libn/memory.c
index d7df8e3..1c7ab07 100644
--- a/sys/libn/memory.c
+++ b/sys/libn/memory.c
@@ -36,23 +36,23 @@ mem·Allocator sys·Memory = {
/* Grow to particular size */
void*
-bufgrow(void* buf, vlong newLen, vlong eltsize)
+·bufgrow(void* buf, vlong newLen, vlong eltsize)
{
assert(bufcap(buf) <= (SIZE_MAX - 1) / 2);
vlong newCap = MAX(16, MAX(1 + 2 * bufcap(buf), newLen));
assert(newLen <= newCap);
- assert(newCap <= (SIZE_MAX - offsetof(bufHdr, buf)) / eltsize);
+ assert(newCap <= (SIZE_MAX - offsetof(BufHdr, buf)) / eltsize);
- vlong newSize = offsetof(bufHdr, buf) + newCap * eltsize;
+ vlong newSize = offsetof(BufHdr, buf) + newCap * eltsize;
- bufHdr* newHdr;
+ BufHdr* newHdr;
if (buf) {
- newHdr = _bufHdr(buf);
- newHdr = (bufHdr*)realloc((void*)newHdr, newSize);
+ newHdr = bufhdr(buf);
+ newHdr = (BufHdr*)realloc((void*)newHdr, newSize);
} else {
- newHdr = (bufHdr*)malloc(newSize);
+ newHdr = (BufHdr*)malloc(newSize);
newHdr->len = 0;
}
@@ -62,20 +62,20 @@ bufgrow(void* buf, vlong newLen, vlong eltsize)
/* Pop out a value */
void
-_bufpop(void *buf, int i, vlong eltsize)
+·bufdel(void *buf, int i, vlong eltsize)
{
int n;
byte *b;
byte stk[1024];
assert(eltsize < sizeof(stk));
- b = (byte*) buf;
- if (n = buflen(buf), i < n) {
+ b = (byte*)buf;
+ if(n = buflen(buf), i < n) {
memcpy(stk, b+eltsize*i, eltsize);
memcpy(b+eltsize*i, b+eltsize*(i+1), eltsize*(n-i-1));
memcpy(b+eltsize*(n-1), stk, eltsize);
}
- _bufHdr(buf)->len--;
+ bufhdr(buf)->len--;
}
// -------------------------------------------------------------------------