From a04f5adc3c748a4bb33d83363b08648d5ba6d79f Mon Sep 17 00:00:00 2001 From: apocelipes Date: Fri, 4 Aug 2023 03:15:12 +0000 Subject: [PATCH] encoding/xml, image/jpeg, image/png: use the builtin min function Change-Id: I9bafc7aa4e20e7cd994b75e7576156ca68f4fc8b GitHub-Last-Rev: e037f689bddd0ef03a6ad38982fe98b4c26aaede GitHub-Pull-Request: golang/go#61746 Reviewed-on: https://go-review.googlesource.com/c/go/+/515855 Run-TryBot: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Reviewed-by: Michael Knyszek Auto-Submit: Ian Lance Taylor --- src/encoding/xml/typeinfo.go | 7 ------- src/image/jpeg/writer.go | 8 -------- src/image/png/reader.go | 7 ------- 3 files changed, 22 deletions(-) diff --git a/src/encoding/xml/typeinfo.go b/src/encoding/xml/typeinfo.go index 12d3918760..b18ed284a6 100644 --- a/src/encoding/xml/typeinfo.go +++ b/src/encoding/xml/typeinfo.go @@ -251,13 +251,6 @@ func lookupXMLName(typ reflect.Type) (xmlname *fieldInfo) { return nil } -func min(a, b int) int { - if a <= b { - return a - } - return b -} - // addFieldInfo adds finfo to tinfo.fields if there are no // conflicts, or if conflicts arise from previous fields that were // obtained from deeper embedded structures than finfo. In the latter diff --git a/src/image/jpeg/writer.go b/src/image/jpeg/writer.go index 0027f78294..f202d6549c 100644 --- a/src/image/jpeg/writer.go +++ b/src/image/jpeg/writer.go @@ -12,14 +12,6 @@ import ( "io" ) -// min returns the minimum of two integers. -func min(x, y int) int { - if x < y { - return x - } - return y -} - // div returns a/b rounded to the nearest integer, instead of rounded to zero. func div(a, b int32) int32 { if a >= 0 { diff --git a/src/image/png/reader.go b/src/image/png/reader.go index 3a717344c2..e852bb28e8 100644 --- a/src/image/png/reader.go +++ b/src/image/png/reader.go @@ -136,13 +136,6 @@ type UnsupportedError string func (e UnsupportedError) Error() string { return "png: unsupported feature: " + string(e) } -func min(a, b int) int { - if a < b { - return a - } - return b -} - func (d *decoder) parseIHDR(length uint32) error { if length != 13 { return FormatError("bad IHDR length")