aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-31 14:53:10 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-31 14:53:10 -0700
commit3297ca7f3a3313e80e49547c857e1593286316b8 (patch)
treee3fc9e24e7ca89be75c1d1981107de8a01d0fe61
parentb6291927ffb898e37fd482b08669b3577e4d669a (diff)
minor changes
-rw-r--r--Makefile10
-rw-r--r--compile_commands.json642
-rw-r--r--include/libn.h8
-rw-r--r--include/u.h10
-rw-r--r--sys/cmd/cc/lex.c6
-rw-r--r--sys/cmd/rules.mk5
-rw-r--r--sys/libbio/io/fasta.c6
-rw-r--r--sys/libbio/io/newick.c8
-rw-r--r--sys/libn/bufio.c4
-rw-r--r--sys/libn/memory.c18
-rw-r--r--sys/libn/string.c10
11 files changed, 684 insertions, 43 deletions
diff --git a/Makefile b/Makefile
index 554ccfc..4a70bac 100644
--- a/Makefile
+++ b/Makefile
@@ -12,15 +12,15 @@ OBJ_DIR := build
TST_DIR := test
# C runtime library
-CINIT := $(LIB_DIR)/crt/crt1.o $(LIB_DIR)/crt/x86_64/crti.o `gcc --print-file-name=crtbeginS.o`
-CFINI := `gcc --print-file-name=crtendS.o` $(LIB_DIR)/crt/x86_64/crtn.o
+CINIT := #$(LIB_DIR)/crt/crt1.o $(LIB_DIR)/crt/x86_64/crti.o `gcc --print-file-name=crtbeginS.o`
+CFINI := #`gcc --print-file-name=crtendS.o` $(LIB_DIR)/crt/x86_64/crtn.o
# Flags, Libraries and Includes
CFLAGS := -g -march=native -fno-strict-aliasing -fwrapv -fms-extensions
-STATIC := -static -nodefaultlibs -nostartfiles
+STATIC := #-nodefaultlibs -nostartfiles -static
AFLAGS := -f elf64
-INCS := -I $(INC_DIR) -isystem $(INC_DIR)/vendor/libc
-ELIBS := -L$(LIB_DIR) -lc
+INCS := -I $(INC_DIR) #-isystem $(INC_DIR)/vendor/libc
+ELIBS := #-L$(LIB_DIR) -lc
# Named generic rules (must be evaluated lazily)
COMPILE = @echo "CC "$@;\
diff --git a/compile_commands.json b/compile_commands.json
index 3e7cc3c..82823e4 100644
--- a/compile_commands.json
+++ b/compile_commands.json
@@ -8,8 +8,556 @@
"-fno-strict-aliasing",
"-fwrapv",
"-fms-extensions",
- "-isystem",
- "include/vendor/libc",
+ "-I",
+ "include",
+ "-o",
+ "build/libmath/blas1.o",
+ "sys/libmath/blas1.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libmath/blas1.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/random.o",
+ "sys/libn/random.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/random.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libbio/test.o",
+ "sys/libbio/test.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libbio/test.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libbio/simulate.o",
+ "sys/libbio/simulate.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libbio/simulate.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/os.o",
+ "sys/libn/os.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/os.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/mmap.o",
+ "sys/libn/mmap.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/mmap.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/error.o",
+ "sys/libn/error.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/error.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-I/usr/include/freetype2",
+ "-I/usr/include/libpng16",
+ "-I/usr/include/harfbuzz",
+ "-I/usr/include/glib-2.0",
+ "-I/usr/lib/glib-2.0/include",
+ "-I/usr/include/freetype2",
+ "-I/usr/include/libpng16",
+ "-I/usr/include/harfbuzz",
+ "-I/usr/include/glib-2.0",
+ "-I/usr/lib/glib-2.0/include",
+ "-o",
+ "build/cmd/term/x.o",
+ "sys/cmd/term/x.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/term/x.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/cmd/cc/lex.o",
+ "sys/cmd/cc/lex.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/cc/lex.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/io.o",
+ "sys/libn/io.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/io.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-D_GNU_SOURCE",
+ "-I",
+ "include",
+ "-o",
+ "build/libmath/test.o",
+ "sys/libmath/test.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libmath/test.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/flate.o",
+ "sys/libn/flate.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/flate.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/test.o",
+ "sys/libn/test.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/test.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/cmd/cc/bits.o",
+ "sys/cmd/cc/bits.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/cc/bits.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/gz.o",
+ "sys/libn/gz.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/gz.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/cmd/cc/pp.o",
+ "sys/cmd/cc/pp.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/cc/pp.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-ffreestanding",
+ "-fno-builtin",
+ "-nostdlib",
+ "-I",
+ "include",
+ "-o",
+ "build/libc/stdio.o",
+ "sys/libc/stdio.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libc/stdio.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libbio/io/newick.o",
+ "sys/libbio/io/newick.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libbio/io/newick.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/memory.o",
+ "sys/libn/memory.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/memory.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-ffreestanding",
+ "-fno-builtin",
+ "-nostdlib",
+ "-I",
+ "include",
+ "-o",
+ "build/libc/string.o",
+ "sys/libc/string.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libc/string.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-I/usr/include/freetype2",
+ "-I/usr/include/libpng16",
+ "-I/usr/include/harfbuzz",
+ "-I/usr/include/glib-2.0",
+ "-I/usr/lib/glib-2.0/include",
+ "-I/usr/include/freetype2",
+ "-I/usr/include/libpng16",
+ "-I/usr/include/harfbuzz",
+ "-I/usr/include/glib-2.0",
+ "-I/usr/lib/glib-2.0/include",
+ "-o",
+ "build/cmd/term/term.o",
+ "sys/cmd/term/term.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/term/term.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libmath/blas3.o",
+ "sys/libmath/blas3.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libmath/blas3.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libbio/phylo.o",
+ "sys/libbio/phylo.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libbio/phylo.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libbio/io/fasta.o",
+ "sys/libbio/io/fasta.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libbio/io/fasta.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libmath/blas2.o",
+ "sys/libmath/blas2.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libmath/blas2.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/coro.o",
+ "sys/libn/coro.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/coro.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-D_GNU_SOURCE",
+ "-I",
+ "include",
+ "-o",
+ "build/libmath/blas.o",
+ "sys/libmath/blas.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libmath/blas.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/cmd/cc/cc.o",
+ "sys/cmd/cc/cc.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/cc/cc.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/sort.o",
+ "sys/libn/sort.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/sort.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
"-I",
"include",
"-o",
@@ -18,5 +566,95 @@
],
"directory": "/home/nolln/root",
"file": "sys/cmd/cc/ast.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/bufio.o",
+ "sys/libn/bufio.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/bufio.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libmath/basic.o",
+ "sys/libmath/basic.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libmath/basic.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libn/string.o",
+ "sys/libn/string.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libn/string.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/cmd/cat/cat.o",
+ "sys/cmd/cat/cat.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/cmd/cat/cat.c"
+ },
+ {
+ "arguments": [
+ "gcc",
+ "-c",
+ "-g",
+ "-march=native",
+ "-fno-strict-aliasing",
+ "-fwrapv",
+ "-fms-extensions",
+ "-I",
+ "include",
+ "-o",
+ "build/libbio/align.o",
+ "sys/libbio/align.c"
+ ],
+ "directory": "/home/nolln/root",
+ "file": "sys/libbio/align.c"
}
] \ No newline at end of file
diff --git a/include/libn.h b/include/libn.h
index 721defd..a4b9bf5 100644
--- a/include/libn.h
+++ b/include/libn.h
@@ -155,8 +155,8 @@ typedef uint32 rune;
int utf8·fullrune(byte *s, int n);
byte *utf8·findrune(byte *s, long i);
byte *utf8·findrrune(byte* s, long c);
-int utf8·chartorune(rune *r, byte *s);
-int utf8·runetochar(byte *s, rune *r);
+int utf8·bytetorune(rune *r, byte *s);
+int utf8·runetobyte(byte *s, rune *r);
int utf8·len(byte *s);
int utf8·runelen(rune r);
int utf8·isletter(rune r);
@@ -377,6 +377,8 @@ uint64 rng·randi(int max);
/* from plan9 libc */
+#define ERRMAX 128 /* max length of error string */
+
#define SET(x) ((x)=0)
#define USED(x) if(x){}else{}
#ifdef __GNUC__
@@ -397,7 +399,7 @@ extern char *argv0;
argc--; argv++; break;\
}\
_argc = 0;\
- while(*_args && (_args += utf8·chartorune(&_argc, _args)))\
+ while(*_args && (_args += utf8·bytetorune(&_argc, _args)))\
switch(_argc)
#define ARGEND SET(_argt);USED(_argt);USED(_argc);USED(_args);}USED(argv);USED(argc);
#define ARGF() (_argt=_args, _args="",\
diff --git a/include/u.h b/include/u.h
index 8044fe0..d6d6f16 100644
--- a/include/u.h
+++ b/include/u.h
@@ -17,8 +17,12 @@ typedef char byte;
typedef unsigned char ubyte;
typedef signed char sbyte;
+typedef unsigned long ulong;
+typedef signed long slong;
+
typedef long long vlong;
typedef unsigned long long uvlong;
+typedef signed long long svlong;
typedef unsigned int uint;
typedef uint8_t uint8;
@@ -44,12 +48,6 @@ typedef int error;
// ------------------------------------------------------------------
// Global macros
-#ifdef RELEASE
-#define Assert(x)
-#else
-#define Assert(x) assert(x)
-#endif
-
#define arrlen(Array) (sizeof(Array) / sizeof((Array)[0]))
#define arrend(Array) ((Array) + arrlen(Array))
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;