Commit 550b7ccf authored by Marvin Stenger's avatar Marvin Stenger Committed by Brad Fitzpatrick

cmd/link/internal/ld: removed some uses of stringsCompare

Only one use of stringsCompare is left. Cannot simply be replaced by
strings.Compare for bootstrapping reasons I guess.
Moving the function away from util.go to the actual destination data.go
also would not help much. So I left this one unchanged for readability and convenience.

Change-Id: I60d22fec0be8f8c47c80586436f9a550af59194e
Reviewed-on: https://go-review.googlesource.com/14953Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent ffe74394
......@@ -625,10 +625,10 @@ func (x machoscmp) Less(i, j int) bool {
k1 := symkind(s1)
k2 := symkind(s2)
if k1 != k2 {
return k1-k2 < 0
return k1 < k2
}
return stringsCompare(s1.Extname, s2.Extname) < 0
return s1.Extname < s2.Extname
}
func machogenasmsym(put func(*LSym, string, int, int64, int64, int, *LSym)) {
......
......@@ -684,21 +684,11 @@ func addimports(datsect *IMAGE_SECTION_HEADER) {
Cseek(endoff)
}
type pescmp []*LSym
type byExtname []*LSym
func (x pescmp) Len() int {
return len(x)
}
func (x pescmp) Swap(i, j int) {
x[i], x[j] = x[j], x[i]
}
func (x pescmp) Less(i, j int) bool {
s1 := x[i]
s2 := x[j]
return stringsCompare(s1.Extname, s2.Extname) < 0
}
func (s byExtname) Len() int { return len(s) }
func (s byExtname) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s byExtname) Less(i, j int) bool { return s[i].Extname < s[j].Extname }
func initdynexport() {
nexport = 0
......@@ -715,7 +705,7 @@ func initdynexport() {
nexport++
}
sort.Sort(pescmp(dexport[:nexport]))
sort.Sort(byExtname(dexport[:nexport]))
}
func addexports() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment