diff options
author | David Robillard <d@drobilla.net> | 2020-11-11 13:32:25 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-11 13:32:25 +0100 |
commit | 0b9b41242f69644c43dc29861c9a4ac6d8768423 (patch) | |
tree | dfc2295785d83f4b95ab3daab731f5f8a50cb806 | |
parent | f02ff178ad0fc9c180a718cfa6786e2e5465f28a (diff) | |
download | sord-0b9b41242f69644c43dc29861c9a4ac6d8768423.tar.gz sord-0b9b41242f69644c43dc29861c9a4ac6d8768423.tar.bz2 sord-0b9b41242f69644c43dc29861c9a4ac6d8768423.zip |
Fix unsigned integer underflow
This is not undefined behaviour, but sanitizers have a check for it that is
useful sometimes, and this makes the return value more predictable anyway.
-rw-r--r-- | src/sord.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -239,7 +239,7 @@ sord_node_compare(const SordNode* a, const SordNode* b) if (a == b || !a || !b) { return 0; // Exact or wildcard match } else if (a->node.type != b->node.type) { - return a->node.type - b->node.type; + return (a->node.type < b->node.type) ? -1 : 1; } int cmp = 0; |