aboutsummaryrefslogtreecommitdiff
path: root/sys/libn
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 /sys/libn
parentb6291927ffb898e37fd482b08669b3577e4d669a (diff)
minor changes
Diffstat (limited to 'sys/libn')
-rw-r--r--sys/libn/bufio.c4
-rw-r--r--sys/libn/memory.c18
-rw-r--r--sys/libn/string.c10
3 files changed, 16 insertions, 16 deletions
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;