diff options
Diffstat (limited to 'libgo/runtime/string.goc')
-rw-r--r-- | libgo/runtime/string.goc | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libgo/runtime/string.goc b/libgo/runtime/string.goc index a7446e93c4..0ad180b983 100644 --- a/libgo/runtime/string.goc +++ b/libgo/runtime/string.goc @@ -7,7 +7,6 @@ package runtime #include "arch.h" #include "malloc.h" #include "go-string.h" -#include "race.h" #define charntorune(pv, str, len) __go_get_rune(str, len, pv) @@ -43,11 +42,9 @@ gostringsize(intgo l, byte** pmem) *pmem = nil; return runtime_emptystring; } - // leave room for NUL for C runtime (e.g., callers of getenv) - mem = runtime_mallocgc(l+1, 0, FlagNoScan|FlagNoZero); + mem = runtime_mallocgc(l, 0, FlagNoScan|FlagNoZero); s.str = mem; s.len = l; - mem[l] = 0; *pmem = mem; return s; } @@ -75,13 +72,8 @@ runtime_gostringnocopy(const byte *str) return s; } -String runtime_cstringToGo(byte*) - __asm__ (GOSYM_PREFIX "runtime.cstringToGo"); - -String -runtime_cstringToGo(byte *str) -{ - return runtime_gostringnocopy(str); +func cstringToGo(str *byte) (s String) { + s = runtime_gostringnocopy(str); } enum |