aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/parse.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-01-18 19:04:36 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-01-18 19:04:36 +0000
commit4f4a855d82a889cebcfca150a7a43909bcb6a346 (patch)
treef12bae0781920fa34669fe30b6f4615a86d9fb80 /libgo/go/net/parse.go
parent225220d668dafb8262db7012bced688acbe63b33 (diff)
downloadgcc-4f4a855d82a889cebcfca150a7a43909bcb6a346.zip
gcc-4f4a855d82a889cebcfca150a7a43909bcb6a346.tar.gz
gcc-4f4a855d82a889cebcfca150a7a43909bcb6a346.tar.bz2
libgo: update to Go1.12beta2
Reviewed-on: https://go-review.googlesource.com/c/158019 gotools/: * Makefile.am (go_cmd_vet_files): Update for Go1.12beta2 release. (GOTOOLS_TEST_TIMEOUT): Increase to 600. (check-runtime): Export LD_LIBRARY_PATH before computing GOARCH and GOOS. (check-vet): Copy golang.org/x/tools into check-vet-dir. * Makefile.in: Regenerate. gcc/testsuite/: * go.go-torture/execute/names-1.go: Stop using debug/xcoff, which is no longer externally visible. From-SVN: r268084
Diffstat (limited to 'libgo/go/net/parse.go')
-rw-r--r--libgo/go/net/parse.go26
1 files changed, 6 insertions, 20 deletions
diff --git a/libgo/go/net/parse.go b/libgo/go/net/parse.go
index a2d9245..cdb35bb 100644
--- a/libgo/go/net/parse.go
+++ b/libgo/go/net/parse.go
@@ -8,10 +8,10 @@
package net
import (
+ "internal/bytealg"
"io"
"os"
"time"
- _ "unsafe" // For go:linkname
)
type file struct {
@@ -80,18 +80,11 @@ func stat(name string) (mtime time.Time, size int64, err error) {
return st.ModTime(), st.Size(), nil
}
-// byteIndex is strings.IndexByte. It returns the index of the
-// first instance of c in s, or -1 if c is not present in s.
-// strings.IndexByte is implemented in runtime/asm_$GOARCH.s
-//go:linkname byteIndex strings.IndexByte
-//extern strings.IndexByte
-func byteIndex(s string, c byte) int
-
// Count occurrences in s of any bytes in t.
func countAnyByte(s string, t string) int {
n := 0
for i := 0; i < len(s); i++ {
- if byteIndex(t, s[i]) >= 0 {
+ if bytealg.IndexByteString(t, s[i]) >= 0 {
n++
}
}
@@ -104,7 +97,7 @@ func splitAtBytes(s string, t string) []string {
n := 0
last := 0
for i := 0; i < len(s); i++ {
- if byteIndex(t, s[i]) >= 0 {
+ if bytealg.IndexByteString(t, s[i]) >= 0 {
if last < i {
a[n] = s[last:i]
n++
@@ -277,7 +270,7 @@ func isSpace(b byte) bool {
// removeComment returns line, removing any '#' byte and any following
// bytes.
func removeComment(line []byte) []byte {
- if i := bytesIndexByte(line, '#'); i != -1 {
+ if i := bytealg.IndexByte(line, '#'); i != -1 {
return line[:i]
}
return line
@@ -288,7 +281,7 @@ func removeComment(line []byte) []byte {
// It returns the first non-nil error returned by fn.
func foreachLine(x []byte, fn func(line []byte) error) error {
for len(x) > 0 {
- nl := bytesIndexByte(x, '\n')
+ nl := bytealg.IndexByte(x, '\n')
if nl == -1 {
return fn(x)
}
@@ -306,7 +299,7 @@ func foreachLine(x []byte, fn func(line []byte) error) error {
func foreachField(x []byte, fn func(field []byte) error) error {
x = trimSpace(x)
for len(x) > 0 {
- sp := bytesIndexByte(x, ' ')
+ sp := bytealg.IndexByte(x, ' ')
if sp == -1 {
return fn(x)
}
@@ -320,13 +313,6 @@ func foreachField(x []byte, fn func(field []byte) error) error {
return nil
}
-// bytesIndexByte is bytes.IndexByte. It returns the index of the
-// first instance of c in s, or -1 if c is not present in s.
-// bytes.IndexByte is implemented in runtime/asm_$GOARCH.s
-//go:linkname bytesIndexByte bytes.IndexByte
-//extern bytes.IndexByte
-func bytesIndexByte(s []byte, c byte) int
-
// stringsHasSuffix is strings.HasSuffix. It reports whether s ends in
// suffix.
func stringsHasSuffix(s, suffix string) bool {