From 96fab802403fb70aaeaf270f34135d928a2bbc96 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Tue, 13 Oct 2015 17:20:44 -0400 Subject: rename valloc and balloc valloc is actually a POSIX function that prevents compilation on some systems. --- lisc/lisc.h | 4 ++-- lisc/parse.c | 8 ++++---- lisc/rega.c | 2 +- lisc/util.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lisc/lisc.h b/lisc/lisc.h index 6bf15b9..b7b7c75 100644 --- a/lisc/lisc.h +++ b/lisc/lisc.h @@ -294,13 +294,13 @@ void diag(char *); void *emalloc(size_t); void *alloc(size_t); void freeall(void); -Blk *balloc(void); +Blk *bnew(void); void emit(int, int, Ref, Ref, Ref); void emiti(Ins); int bcnt(Bits *); void idup(Ins **, Ins *, ulong); Ins *icpy(Ins *, Ins *, ulong); -void *valloc(ulong, size_t); +void *vnew(ulong, size_t); void vgrow(void *, ulong); Ref newtmp(char *, Fn *); Ref getcon(int64_t, Fn *); diff --git a/lisc/parse.c b/lisc/parse.c index d9eda74..df153ee 100644 --- a/lisc/parse.c +++ b/lisc/parse.c @@ -211,7 +211,7 @@ lex() return TNum; } if (c == '"') { - tokval.str = valloc(0, 1); + tokval.str = vnew(0, 1); for (i=0;; i++) { c = fgetc(inf); if (c == '"') @@ -426,7 +426,7 @@ findblk(char *name) if (i == NBlk) err("too many blocks"); if (!bmap[i]) { - bmap[i] = balloc(); + bmap[i] = bnew(); nblk++; strcpy(bmap[i]->name, name); } @@ -625,9 +625,9 @@ parsefn() err("empty file"); if (curb->jmp.type == JXXX) err("last block misses jump"); - fn->tmp = valloc(ntmp, sizeof tmp[0]); + fn->tmp = vnew(ntmp, sizeof tmp[0]); memcpy(fn->tmp, tmp, ntmp * sizeof tmp[0]); - fn->con = valloc(ncon, sizeof con[0]); + fn->con = vnew(ncon, sizeof con[0]); memcpy(fn->con, con, ncon * sizeof con[0]); fn->ntmp = ntmp; fn->ncon = ncon; diff --git a/lisc/rega.c b/lisc/rega.c index dc9473c..b0db117 100644 --- a/lisc/rega.c +++ b/lisc/rega.c @@ -421,7 +421,7 @@ rega(Fn *fn) pmgen(); if (curi == insb) continue; - b1 = balloc(); + b1 = bnew(); b1->loop = (b->loop+s->loop) / 2; b1->link = blist; blist = b1; diff --git a/lisc/util.c b/lisc/util.c index b73734c..1d5ce7c 100644 --- a/lisc/util.c +++ b/lisc/util.c @@ -81,7 +81,7 @@ freeall() } Blk * -balloc() +bnew() { static Blk z; Blk *b; @@ -137,7 +137,7 @@ icpy(Ins *d, Ins *s, ulong n) } void * -valloc(ulong len, size_t esz) +vnew(ulong len, size_t esz) { ulong cap; Vec *v; @@ -161,7 +161,7 @@ vgrow(void *vp, ulong len) assert(v+1 && v->mag == VMag); if (v->cap >= len) return; - v1 = valloc(len, v->esz); + v1 = vnew(len, v->esz); memcpy(v1, v+1, v->cap * v->esz); *(Vec **)vp = v1; } -- cgit 1.4.1