]> Cypherpunks repositories - gostls13.git/commitdiff
go: replace bytes.Compare with bytes.Equal
authorcuiweixie <cuiweixie@gmail.com>
Thu, 29 Sep 2022 13:40:39 +0000 (21:40 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 30 Sep 2022 14:14:36 +0000 (14:14 +0000)
Change-Id: I268033bfcda34b76ef1d3a3446d6d1d875fc33ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/436716
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/go/internal/gccgoimporter/ar.go

index 443aa26a0cdf57982c8b9f57d1fae495e9643f58..9df7934212611b34d21d49b035dc5b7794547a48 100644 (file)
@@ -82,7 +82,7 @@ func standardArExportData(archive io.ReadSeeker) (io.ReadSeeker, error) {
                }
                off += arHdrSize
 
-               if bytes.Compare(hdrBuf[arFmagOff:arFmagOff+arFmagSize], []byte(arfmag)) != 0 {
+               if !bytes.Equal(hdrBuf[arFmagOff:arFmagOff+arFmagSize], []byte(arfmag)) {
                        return nil, fmt.Errorf("archive header format header (%q)", hdrBuf[:])
                }
 
@@ -92,7 +92,7 @@ func standardArExportData(archive io.ReadSeeker) (io.ReadSeeker, error) {
                }
 
                fn := hdrBuf[arNameOff : arNameOff+arNameSize]
-               if fn[0] == '/' && (fn[1] == ' ' || fn[1] == '/' || bytes.Compare(fn[:8], []byte("/SYM64/ ")) == 0) {
+               if fn[0] == '/' && (fn[1] == ' ' || fn[1] == '/' || string(fn[:8]) == "/SYM64/ ") {
                        // Archive symbol table or extended name table,
                        // which we don't care about.
                } else {