Switch up comparator mapping to avoid these kinds of errors, use a
simple array of (name, comparator) pairs rather than having to maintain
entries in two separate arrays that must have matching indices.
Details
Details
- Reviewers
bapt imp pstef obiwac - Commits
- rG5f72125339b1: top: improve sort field storage/lookup
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Whoops, good shout. Just axing this entirely:
, but the `equivalent comparator wasn't added at that time.[...]
usr.bin/top/machine.c | ||
---|---|---|
1674–1675 | Switch to designated initializers? |
usr.bin/top/machine.c | ||
---|---|---|
1674–1675 | It's a bit awkward since we're cross-referencing between two arrays, but yeah, good point- I'll go ahead and switch this to a simple array of string, comparator pairs |
Comment Actions
I'm going to commit the previous version of this as a stupid simple fix to get into 13.2, but still wanted to improve this.
usr.bin/top/machine.c | ||
---|---|---|
236 | Could this array be const? |
Comment Actions
string_index (utils.c) isn't used anymore - should it be removed?
otherwise looks good to me
Comment Actions
GC the now-unused string_index(); refresh the diff, since this has been rebased
continuously over the past three years in my local tree and the current diff in
phab may not actually apply.