diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-10-30 09:35:42 +0000 |
---|---|---|
committer | <> | 2015-01-09 11:51:27 +0000 |
commit | c27a97d04853380f1e80525391b3f0d156ed4c84 (patch) | |
tree | 68ffaade7c605bc80cffa18360799c98a810976f /libgo/runtime/go-strplus.c | |
parent | 6af3fdec2262dd94954acc5e426ef71cbd4521d3 (diff) | |
download | gcc-tarball-c27a97d04853380f1e80525391b3f0d156ed4c84.tar.gz |
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-4.9.2.tar.bz2.gcc-4.9.2
Diffstat (limited to 'libgo/runtime/go-strplus.c')
-rw-r--r-- | libgo/runtime/go-strplus.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/libgo/runtime/go-strplus.c b/libgo/runtime/go-strplus.c index bfbe3412a7..13915e3e67 100644 --- a/libgo/runtime/go-strplus.c +++ b/libgo/runtime/go-strplus.c @@ -4,28 +4,27 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */ -#include "go-string.h" #include "runtime.h" #include "arch.h" #include "malloc.h" -struct __go_string -__go_string_plus (struct __go_string s1, struct __go_string s2) +String +__go_string_plus (String s1, String s2) { int len; - unsigned char *retdata; - struct __go_string ret; + byte *retdata; + String ret; - if (s1.__length == 0) + if (s1.len == 0) return s2; - else if (s2.__length == 0) + else if (s2.len == 0) return s1; - len = s1.__length + s2.__length; - retdata = runtime_mallocgc (len, FlagNoPointers, 1, 0); - __builtin_memcpy (retdata, s1.__data, s1.__length); - __builtin_memcpy (retdata + s1.__length, s2.__data, s2.__length); - ret.__data = retdata; - ret.__length = len; + len = s1.len + s2.len; + retdata = runtime_mallocgc (len, 0, FlagNoScan | FlagNoZero); + __builtin_memcpy (retdata, s1.str, s1.len); + __builtin_memcpy (retdata + s1.len, s2.str, s2.len); + ret.str = retdata; + ret.len = len; return ret; } |