summaryrefslogtreecommitdiffstats
path: root/src/sord.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-11 13:32:25 +0100
committerDavid Robillard <d@drobilla.net>2020-11-11 13:32:25 +0100
commit0b9b41242f69644c43dc29861c9a4ac6d8768423 (patch)
treedfc2295785d83f4b95ab3daab731f5f8a50cb806 /src/sord.c
parentf02ff178ad0fc9c180a718cfa6786e2e5465f28a (diff)
downloadsord-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.
Diffstat (limited to 'src/sord.c')
-rw-r--r--src/sord.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sord.c b/src/sord.c
index 0ea4220..52c6e32 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -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;