From 3297ca7f3a3313e80e49547c857e1593286316b8 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sun, 31 May 2020 14:53:10 -0700 Subject: minor changes --- sys/cmd/cc/lex.c | 6 +++--- sys/cmd/rules.mk | 5 ++++- sys/libbio/io/fasta.c | 6 +++--- sys/libbio/io/newick.c | 8 ++++---- sys/libn/bufio.c | 4 ++-- sys/libn/memory.c | 18 +++++++++--------- sys/libn/string.c | 10 +++++----- 7 files changed, 30 insertions(+), 27 deletions(-) (limited to 'sys') diff --git a/sys/cmd/cc/lex.c b/sys/cmd/cc/lex.c index 97e19e4..1396358 100644 --- a/sys/cmd/cc/lex.c +++ b/sys/cmd/cc/lex.c @@ -32,7 +32,6 @@ Io* openio(Lexer *lx, byte *path) { string *it, *end; - Stream *f; intern(&path); @@ -441,7 +440,7 @@ Dispatch: else { r = v; b = utf8·runelen(r); - utf8·runetochar(lx->buf, &r); + utf8·runetobyte(lx->buf, &r); str·appendlen(&s, b, lx->buf); } } @@ -725,7 +724,7 @@ Dispatch: if (!utf8·isletter(r) && !utf8·isdigit(r) && r != 0xb7) { errorat(lx->pos, "invalid identifier character %d", r); } - s += utf8·runetochar(s, &r); + s += utf8·runetobyte(s, &r); } else if (!isalnum(b) && b != '_') break; else @@ -778,6 +777,7 @@ Return: Nospace: panicf("aborting compilation"); + exit(1); } #undef CASE4 diff --git a/sys/cmd/rules.mk b/sys/cmd/rules.mk index c648907..63a92df 100644 --- a/sys/cmd/rules.mk +++ b/sys/cmd/rules.mk @@ -11,7 +11,10 @@ include $(DIR)/rules.mk # DIR := $(d)/edo # include $(DIR)/rules.mk -DIR := $(d)/rc +# DIR := $(d)/rc +# include $(DIR)/rules.mk + +DIR := $(d)/term include $(DIR)/rules.mk include share/pop.mk diff --git a/sys/libbio/io/fasta.c b/sys/libbio/io/fasta.c index bb6bfc7..28c9ca4 100644 --- a/sys/libbio/io/fasta.c +++ b/sys/libbio/io/fasta.c @@ -32,9 +32,9 @@ grow(struct Seqbuf **sb, int min) vlong newlen; old = *sb; - Assert((*sb)->len <= (SIZE_MAX - 1) / 2); + assert((*sb)->len <= (SIZE_MAX - 1) / 2); newlen = MAX(16, MAX(1 + 2*(*sb)->len, (*sb)->len+min)); - Assert(newlen >= (*sb)->len+min); + assert(newlen >= (*sb)->len+min); if (new = old->heap.alloc(old->h, 1, sizeof(*new)+newlen), !new) { errorf("memory: could not allocate new buffer"); @@ -179,7 +179,7 @@ readfasta(bio·FastaReader *rdr, bio·Seq *seq, byte hdr, byte stop) reset(rdr->seq); // NOTE: Can this case happen? - Assert(rdr->b != rdr->bend); + assert(rdr->b != rdr->bend); if (*rdr->b++ != hdr) { errorf("fasta/q format: expected '%c', found '%c'", hdr, *rdr->b--); return 1; diff --git a/sys/libbio/io/newick.c b/sys/libbio/io/newick.c index da94ef2..164516f 100644 --- a/sys/libbio/io/newick.c +++ b/sys/libbio/io/newick.c @@ -86,7 +86,7 @@ lex(io·Peeker s, void* fp) } s.unget(fp, *c); - Assert(c - b < 1024); + assert(c - b < 1024); *c = 0; tok.kind = tok·space; @@ -114,7 +114,7 @@ lex(io·Peeker s, void* fp) if (isvalidchar(*c)) goto IDENT; s.unget(fp, *c); - Assert(c - b < 1024); + assert(c - b < 1024); *c = 0; tok.kind = tok·number; @@ -125,7 +125,7 @@ lex(io·Peeker s, void* fp) while ((*c) != '\"') { *(++c) = s.get(fp); } - Assert(c - b < 1024); + assert(c - b < 1024); *c = '\0'; tok.kind = tok·ident; @@ -138,7 +138,7 @@ lex(io·Peeker s, void* fp) *(++c) = s.get(fp); } s.unget(fp, *c); - Assert(c - b < 1024); + assert(c - b < 1024); *c = '\0'; tok.kind = tok·ident; diff --git a/sys/libn/bufio.c b/sys/libn/bufio.c index 0a3c419..aaced0e 100644 --- a/sys/libn/bufio.c +++ b/sys/libn/bufio.c @@ -35,7 +35,7 @@ static int refill(io·Buffer *buf) { - int n, d; + int n; if (buf->state & bufio·end) { return bufio·err; @@ -120,7 +120,7 @@ nextbyte: if (!utf8·fullrune(str, i)) goto nextbyte; - buf->runesize = utf8·chartorune(&r, str); + buf->runesize = utf8·bytetorune(&r, str); if (r == RuneErr && b == 1) { errorf("illegal UTF-8 sequence"); for (; i >= 0; i--) diff --git a/sys/libn/memory.c b/sys/libn/memory.c index 7993ca2..46f2478 100644 --- a/sys/libn/memory.c +++ b/sys/libn/memory.c @@ -28,12 +28,12 @@ void * void* bufgrow(void* buf, vlong newLen, vlong eltsize) { - Assert(bufcap(buf) <= (SIZE_MAX - 1) / 2); + 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(newLen <= newCap); + assert(newCap <= (SIZE_MAX - offsetof(bufHdr, buf)) / eltsize); vlong newSize = offsetof(bufHdr, buf) + newCap * eltsize; @@ -57,7 +57,7 @@ _bufpop(void *buf, int i, vlong eltsize) int n; byte *b; byte stk[1024]; - Assert(eltsize < sizeof(stk)); + assert(eltsize < sizeof(stk)); b = (byte*) buf; if (n = buflen(buf), i < n) { @@ -121,8 +121,8 @@ grow(mem·Arena *a, vlong min) a->off = blk->buf; a->end = a->off + size; - Assert(a->curr->next == nil); - Assert(a->off == ALIGN_DOWN_PTR(a->off, ARENA_ALIGN)); + assert(a->curr->next == nil); + assert(a->off == ALIGN_DOWN_PTR(a->off, ARENA_ALIGN)); a->curr->next = blk; a->curr = blk; @@ -141,14 +141,14 @@ mem·arenaalloc(mem·Arena *a, uint n, ulong size) if (size > (ulong)(a->end - a->off)) { grow(a, size); - Assert(size <= (uintptr)(a->end - a->off)); + assert(size <= (uintptr)(a->end - a->off)); } ptr = a->off; a->off = ALIGN_UP_PTR(a->off + size, ARENA_ALIGN); - Assert(a->off <= a->end); - Assert(ptr == ALIGN_DOWN_PTR(ptr, ARENA_ALIGN)); + assert(a->off <= a->end); + assert(ptr == ALIGN_DOWN_PTR(ptr, ARENA_ALIGN)); return ptr; } diff --git a/sys/libn/string.c b/sys/libn/string.c index e2cdddf..bf5d645 100644 --- a/sys/libn/string.c +++ b/sys/libn/string.c @@ -34,7 +34,7 @@ enum }; int -utf8·chartorune(rune* r, byte* s) +utf8·bytetorune(rune* r, byte* s) { int c[UTFmax], i; rune l; @@ -72,7 +72,7 @@ bad: } int -utf8·runetochar(byte* s, rune* r) +utf8·runetobyte(byte* s, rune* r) { int i, j; rune c; @@ -105,7 +105,7 @@ int utf8·runelen(rune r) { byte s[10]; - return utf8·runetochar(s, &r); + return utf8·runetobyte(s, &r); } int @@ -142,7 +142,7 @@ utf8·findrune(byte* s, long c) s++; continue; } - n = utf8·chartorune(&r, s); + n = utf8·bytetorune(&r, s); if (r == c) return s; s += n; } @@ -169,7 +169,7 @@ utf8·findrrune(byte* s, long c) s++; continue; } - c1 = utf8·chartorune(&r, s); + c1 = utf8·bytetorune(&r, s); if (r == c) l = s; s += c1; -- cgit v1.2.1