This commit is contained in:
Zxilly 2024-08-30 12:11:12 +08:00
parent a5f283c1d2
commit a50bc9f6ba
No known key found for this signature in database
GPG Key ID: 47AB1DEC841BC6A2
1 changed files with 3 additions and 3 deletions

View File

@ -831,10 +831,10 @@ type FuncLines struct {
// ByTopoCmp sorts topologically: target function is on top,
// followed by inlined functions sorted by filename and line numbers.
func ByTopoCmp(a, b *FuncLines) int {
if a.Filename == b.Filename {
return cmp.Compare(a.StartLineno, b.StartLineno)
if r := strings.Compare(a.Filename, b.Filename); r != 0 {
return r
}
return strings.Compare(a.Filename, b.Filename)
return cmp.Compare(a.StartLineno, b.StartLineno)
}
// WriteSources writes lines as source code in a column headed by title.