From: Tobias Klauser Date: Tue, 8 Oct 2024 11:12:12 +0000 (+0200) Subject: encoding/asn1: use slices.Equal in ObjectIdentifier.Equal X-Git-Tag: go1.24rc1~724 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dd281fd616f2dd762826669dd52af37b1bb7fb83;p=gostls13.git encoding/asn1: use slices.Equal in ObjectIdentifier.Equal Change-Id: I5efe3b9dcee85dfa34b6072c6f85108b6fc7cf99 Reviewed-on: https://go-review.googlesource.com/c/go/+/618515 Auto-Submit: Tobias Klauser LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Reviewed-by: Roland Shoemaker --- diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go index 56e007d3a6..488fb9b1e0 100644 --- a/src/encoding/asn1/asn1.go +++ b/src/encoding/asn1/asn1.go @@ -25,6 +25,7 @@ import ( "math" "math/big" "reflect" + "slices" "strconv" "strings" "time" @@ -224,16 +225,7 @@ type ObjectIdentifier []int // Equal reports whether oi and other represent the same identifier. func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool { - if len(oi) != len(other) { - return false - } - for i := 0; i < len(oi); i++ { - if oi[i] != other[i] { - return false - } - } - - return true + return slices.Equal(oi, other) } func (oi ObjectIdentifier) String() string {