aboutsummaryrefslogtreecommitdiff
path: root/src/base/string/make.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-12-05 15:17:44 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-12-05 15:17:44 -0800
commitb48327d357e0818d1a6ae2a064cfa7d1567e1242 (patch)
tree4677f228a9846937a7ec71c72a1ab63ab69d68ab /src/base/string/make.c
parentc200dd832789afa298ba45e0b9efdec96c0e92cc (diff)
feat(huge): huge refactor (in progress).
Commented out libc includes to uncover all explicit dependencies. A large fraction has now been ported over (no testing). I did not port over the command line tools, such as the rc shell. These will be done independently - as of now I just want the library to stand independent. Compilation currently fails due to the lack of math functions.
Diffstat (limited to 'src/base/string/make.c')
-rw-r--r--src/base/string/make.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/base/string/make.c b/src/base/string/make.c
index d1e594a..50b8b98 100644
--- a/src/base/string/make.c
+++ b/src/base/string/make.c
@@ -9,7 +9,7 @@ string·makecap(byte *s, vlong len, vlong cap)
struct Hdr* h;
h = malloc(sizeof(*h) + cap + 1);
- if(s == nil) memset(h, 0, sizeof(*h));
+ if(s == nil) mem·set(h, sizeof(*h), 0);
if(h == nil) return nil; // Allocation failed.
@@ -19,8 +19,8 @@ string·makecap(byte *s, vlong len, vlong cap)
if(cap < h->len) goto cleanup;
if(s != nil && cap > 0){
- memcpy(h->buf, s, h->len);
- memset(h->buf + h->len, '\0', h->cap - h->len + 1);
+ mem·copy(h->buf, h->len, s);
+ mem·set(h->buf + h->len, h->cap - h->len + 1, '\0');
}
return h->buf;
@@ -36,7 +36,7 @@ cleanup:
string
string·makelen(byte *s, vlong len)
{
- vlong sl = (!s) ? 0 : strlen(s);
+ vlong sl = (!s) ? 0 : str·len(s);
if(sl < len) panicf("attempted to take a bigger substring than string length");
vlong cap = (len == 0) ? 1 : len;
@@ -48,6 +48,6 @@ string·makelen(byte *s, vlong len)
string
string·make(byte *s)
{
- vlong len = (!s) ? 0 : strlen(s);
+ vlong len = (!s) ? 0 : str·len(s);
return string·makelen(s, len);
}