9d1e3afb54
The actual stack unwind code is still in C, but the rest of the code, notably all the memory allocation, is now in Go. The names are changed to the names used in the Go 1.7 runtime, but the code is necessarily somewhat different. The __go_makefunc_can_recover function is dropped, as the uses of it were removed in https://golang.org/cl/198770044. Reviewed-on: https://go-review.googlesource.com/33414 From-SVN: r242715
24 lines
545 B
C
24 lines
545 B
C
/* go-strslice.c -- the go string slice function.
|
|
|
|
Copyright 2009 The Go Authors. All rights reserved.
|
|
Use of this source code is governed by a BSD-style
|
|
license that can be found in the LICENSE file. */
|
|
|
|
#include "runtime.h"
|
|
|
|
String
|
|
__go_string_slice (String s, intgo start, intgo end)
|
|
{
|
|
intgo len;
|
|
String ret;
|
|
|
|
len = s.len;
|
|
if (end == -1)
|
|
end = len;
|
|
if (start > len || end < start || end > len)
|
|
runtime_panicstring ("string index out of bounds");
|
|
ret.str = s.str + start;
|
|
ret.len = end - start;
|
|
return ret;
|
|
}
|