diff options
Diffstat (limited to 'src/runtime/string.c')
-rw-r--r-- | src/runtime/string.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/runtime/string.c b/src/runtime/string.c index fec66f8a8..4dba5ad7e 100644 --- a/src/runtime/string.c +++ b/src/runtime/string.c @@ -8,7 +8,7 @@ static int32 empty = 0; string emptystring = (string)∅ int32 -findnull(int8 *s) +findnull(byte *s) { int32 l; @@ -17,6 +17,19 @@ findnull(int8 *s) return l; } +string +gostring(byte *str) +{ + int32 l; + string s; + + l = findnull(str); + s = mal(sizeof(s->len)+l+1); + s->len = l; + mcpy(s->str, str, l+1); + return s; +} + void sys·catstring(string s1, string s2, string s3) { |