aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/string.goc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-11-01 03:02:13 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-11-01 03:02:13 +0000
commit776f27a67f26c795ba8c27a4e69525382b9379c3 (patch)
tree0285cca6b375a23d93c20efec03cb9adec30f0e0 /libgo/runtime/string.goc
parent79e0221796bf5897204e8077afc20e34f88dab3b (diff)
downloadgcc-776f27a67f26c795ba8c27a4e69525382b9379c3.zip
gcc-776f27a67f26c795ba8c27a4e69525382b9379c3.tar.gz
gcc-776f27a67f26c795ba8c27a4e69525382b9379c3.tar.bz2
compiler, runtime: More steps toward separating int and intgo.
From-SVN: r193059
Diffstat (limited to 'libgo/runtime/string.goc')
-rw-r--r--libgo/runtime/string.goc19
1 files changed, 10 insertions, 9 deletions
diff --git a/libgo/runtime/string.goc b/libgo/runtime/string.goc
index 4e616c7..d3f0c2d 100644
--- a/libgo/runtime/string.goc
+++ b/libgo/runtime/string.goc
@@ -6,10 +6,11 @@ package runtime
#include "runtime.h"
#include "arch.h"
#include "malloc.h"
+#include "go-string.h"
#define charntorune(pv, str, len) __go_get_rune(str, len, pv)
-int32
+intgo
runtime_findnull(const byte *s)
{
if(s == nil)
@@ -22,8 +23,8 @@ runtime_gostringnocopy(const byte *str)
{
String s;
- s.__data = (const unsigned char *) str;
- s.__length = runtime_findnull(str);
+ s.str = str;
+ s.len = runtime_findnull(str);
return s;
}
@@ -35,40 +36,40 @@ enum
func stringiter(s String, k int) (retk int) {
int32 l;
- if(k >= s.__length) {
+ if(k >= s.len) {
// retk=0 is end of iteration
retk = 0;
goto out;
}
- l = s.__data[k];
+ l = s.str[k];
if(l < Runeself) {
retk = k+1;
goto out;
}
// multi-char rune
- retk = k + charntorune(&l, s.__data+k, s.__length-k);
+ retk = k + charntorune(&l, s.str+k, s.len-k);
out:
}
func stringiter2(s String, k int) (retk int, retv int) {
- if(k >= s.__length) {
+ if(k >= s.len) {
// retk=0 is end of iteration
retk = 0;
retv = 0;
goto out;
}
- retv = s.__data[k];
+ retv = s.str[k];
if(retv < Runeself) {
retk = k+1;
goto out;
}
// multi-char rune
- retk = k + charntorune(&retv, s.__data+k, s.__length-k);
+ retk = k + charntorune(&retv, s.str+k, s.len-k);
out:
}