aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-30 11:54:19 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-30 11:54:19 -0700
commit9e83bf8c3656b736ba3a14d9b7b8af61b48415f4 (patch)
tree4417ac3eafdd744d7a944a6da6bf630844ef5f90 /sys
parent86134ccf82dcafe338e68c14e483ec98cfc94925 (diff)
chore: move from new to make prefix of constructors
Diffstat (limited to 'sys')
-rw-r--r--sys/libbio/io/newick.c6
-rw-r--r--sys/libbio/phylo.c1
-rw-r--r--sys/libbio/test.c2
-rw-r--r--sys/libn/coro.c2
-rw-r--r--sys/libn/flate.c10
-rw-r--r--sys/libn/memory.c2
-rw-r--r--sys/libn/string.c20
-rw-r--r--sys/libn/test.c6
8 files changed, 25 insertions, 24 deletions
diff --git a/sys/libbio/io/newick.c b/sys/libbio/io/newick.c
index 038b41c..f9be2d2 100644
--- a/sys/libbio/io/newick.c
+++ b/sys/libbio/io/newick.c
@@ -229,7 +229,7 @@ parse(struct Parser *p)
errorf("incorrect format: comment found in disallowed region");
goto ERROR;
}
- node->comment = str·new("");
+ node->comment = str·make("");
while (tok.kind != tok·rbrak) {
tok = lex_nospace(p->file, p->fimpl);
if (tok.kind == tok·eof || tok.kind == tok·nil) {
@@ -268,7 +268,7 @@ parse(struct Parser *p)
errorf("parse error: attempting to set name of nil node");
goto ERROR;
}
- node->name = str·new(tok.lit.s);
+ node->name = str·make(tok.lit.s);
} else {
if (p->tok.kind != tok·lparen && p->tok.kind != tok·comma) {
errorf("format error: misplaced identifier for leaf found");
@@ -282,7 +282,7 @@ parse(struct Parser *p)
node = p->heap.alloc(p->himpl, 1, sizeof(*node));
memset(node, 0, sizeof(*node));
- node->name = str·new(tok.lit.s);
+ node->name = str·make(tok.lit.s);
phylo·addchild(p->root, node);
}
diff --git a/sys/libbio/phylo.c b/sys/libbio/phylo.c
index 4bb8f66..1cc5b5d 100644
--- a/sys/libbio/phylo.c
+++ b/sys/libbio/phylo.c
@@ -218,4 +218,5 @@ struct phylo·InferOpts
error
phylo·ancestralinfer(bio·Tree *tree, struct phylo·InferOpts opts)
{
+ return 0;
}
diff --git a/sys/libbio/test.c b/sys/libbio/test.c
index 5059ce6..8054864 100644
--- a/sys/libbio/test.c
+++ b/sys/libbio/test.c
@@ -99,7 +99,7 @@ test·newick()
io·Peeker rdr;
io·Putter wtr;
- heap = mem·newarena(mem·sys, nil);
+ heap = mem·makearena(mem·sys, nil);
rdr = (io·Peeker){.get = &io·getbyte, .unget = &io·ungetbyte};
wtr = (io·Putter){.put = &io·putbyte, .putstr = &io·putstring};
diff --git a/sys/libn/coro.c b/sys/libn/coro.c
index 2ad629b..923bb7e 100644
--- a/sys/libn/coro.c
+++ b/sys/libn/coro.c
@@ -25,7 +25,7 @@ struct Coro
};
Coro*
-coro·new(uintptr stk, uintptr (*func)(Coro*, uintptr))
+coro·make(uintptr stk, uintptr (*func)(Coro*, uintptr))
{
if (!func) return nil;
if (stk == 0) stk = 8192;
diff --git a/sys/libn/flate.c b/sys/libn/flate.c
index b2feaff..c3e363f 100644
--- a/sys/libn/flate.c
+++ b/sys/libn/flate.c
@@ -28,7 +28,7 @@ typedef struct flate·Reader
} flate·Reader;
flate·Reader*
-flate·newreader(io·Reader rdr, void* r, mem·Allocator mem, void* m)
+flate·openreader(io·Reader rdr, void* r, mem·Allocator mem, void* m)
{
error err;
flate·Reader *zrdr;
@@ -69,7 +69,7 @@ ERROR:
}
error
-flate·freereader(flate·Reader *rdr)
+flate·closereader(flate·Reader *rdr)
{
int err;
flate·Reader zrdr;
@@ -121,7 +121,7 @@ READ:
goto ERROR;
}
ERROR:
- flate·freereader(rdr);
+ flate·closereader(rdr);
return -1;
}
@@ -140,7 +140,7 @@ struct flate·Writer
};
flate·Writer*
-flate·newwriter(io·Writer wtr, void* w, mem·Allocator mem, void* m)
+flate·openwriter(io·Writer wtr, void* w, mem·Allocator mem, void* m)
{
error err;
flate·Writer *zwtr;
@@ -179,7 +179,7 @@ ERROR:
}
error
-flate·freewriter(flate·Writer *wtr)
+flate·closewriter(flate·Writer *wtr)
{
int err;
flate·Writer zwtr;
diff --git a/sys/libn/memory.c b/sys/libn/memory.c
index 7a0ca30..4cf92b2 100644
--- a/sys/libn/memory.c
+++ b/sys/libn/memory.c
@@ -77,7 +77,7 @@ struct mem·Arena
};
mem·Arena*
-mem·newarena(mem·Allocator from, void *impl)
+mem·makearena(mem·Allocator from, void *impl)
{
mem·Arena *a = from.alloc(impl, 1, sizeof(*a) + ARENA_BLOCK_SIZE);
a->impl = impl;
diff --git a/sys/libn/string.c b/sys/libn/string.c
index d5bb7ef..4280e27 100644
--- a/sys/libn/string.c
+++ b/sys/libn/string.c
@@ -156,7 +156,7 @@ utf8·findrune(byte* s, long c)
// len defines the length of the C substring that we will copy into our buffer.
// The backing buffer will have capacity cap.
string
-str·newcap(const byte* s, vlong len, vlong cap)
+str·makecap(const byte* s, vlong len, vlong cap)
{
struct str·Hdr* h;
@@ -185,34 +185,34 @@ cleanup:
// New returns a new dynamic string object, initialized from the given C string.
// The backing buffer capacity is equivalent to the string length.
string
-str·newlen(const byte* s, vlong len)
+str·makelen(const byte* s, vlong len)
{
vlong sl = (!s) ? 0 : strlen(s);
if (sl < len) panicf("attempted to take a bigger substring than string length");
vlong cap = (len == 0) ? 1 : len;
- return str·newcap(s, len, cap);
+ return str·makecap(s, len, cap);
}
// New returns a new dynamic string object, initialized from the given C string.
// The backing buffer capacity is equivalent to the string length.
string
-str·new(const byte* s)
+str·make(const byte* s)
{
vlong len = (!s) ? 0 : strlen(s);
- return str·newlen(s, len);
+ return str·makelen(s, len);
}
// Newf returns a new dynamic string object
string
-str·newf(const byte* fmt, ...)
+str·makef(const byte* fmt, ...)
{
va_list args;
va_start(args, fmt);
vlong n = vsnprintf(nil, 0, fmt, args);
va_end(args);
- string s = str·newcap(nil, 0, n);
+ string s = str·makecap(nil, 0, n);
va_start(args, fmt);
vsnprintf(s, n + 1, fmt, args);
@@ -473,7 +473,7 @@ str·split(string s, const byte* tok)
for (vlong i = 0; i < sL - tokL; i++) {
if ((tokL == 1 && s[i] == tokL) || !memcmp(s + i, tok, tokL)) {
- bufpush(fields, str·newlen(s + start, i - start));
+ bufpush(fields, str·makelen(s + start, i - start));
if (fields[buflen(fields) - 1] == nil) goto cleanup;
start = i + tokL;
@@ -481,7 +481,7 @@ str·split(string s, const byte* tok)
}
}
- bufpush(fields, str·newlen(s + start, sL - start));
+ bufpush(fields, str·makelen(s + start, sL - start));
return fields;
@@ -496,7 +496,7 @@ cleanup:
string
str·join(vlong len, byte** fields, const byte* sep)
{
- string s = str·newcap(nil, 0, 10);
+ string s = str·makecap(nil, 0, 10);
int j = 0;
for (j = 0; j < len; j++) {
diff --git a/sys/libn/test.c b/sys/libn/test.c
index 5ee230f..3a21a71 100644
--- a/sys/libn/test.c
+++ b/sys/libn/test.c
@@ -63,7 +63,7 @@ test·coro()
printf("Starting singleton test\n");
for (i = 0; i < arrlen(c); i++) {
- c[i] = coro·new(0, &printtest);
+ c[i] = coro·make(0, &printtest);
}
/* Singleton test */
@@ -91,12 +91,12 @@ test·coro()
Coro *cur, *seq[50];
num = 2;
- seq[0] = coro·new(4096, &sequence);
+ seq[0] = coro·make(4096, &sequence);
cur = *seq;
num = coro·yield(cur, num);
for (i = 1; i < arrlen(seq); i++) {
- seq[i] = coro·new(4096, &filter);
+ seq[i] = coro·make(4096, &filter);
struct PrimeMsg msg = {
.seq = cur,
.p = num,