Repository navigation
Hash ops cleanups - #9764
Hash ops cleanups#9764
Conversation
keszybz
left a comment
There was a problem hiding this comment.
The second commit looks good. But I don't particularly like the first. It makes the code longer. I'd rather prefer to accept
if (x != y)
return y - x;as an idiom, and use it in all comparison functions.
(One particular advantage of the shorter version is that there's less place for typos and copy-paste errors.)
As the variable 'line' is unsigned.
c9d4b18 to
2357724
Compare
|
@keszybz OK. The most part of the first commit has been dropped. Only exception is the compare function for PTAL. |
| if (x->line < y->line) | ||
| return -1; | ||
| if (x->line > y->line) | ||
| return 1; |
There was a problem hiding this comment.
Hmm, that's an interesting bug. So the comparison function was borked all the time and nobody noticed.
|
How about this? (Let me know if you like it, I can polish it and test it, push a PR...) |
|
@filbranden lgtm. |
Follow up for PRs systemd#9764 and systemd#9760.
C.f. #9760 (comment).