diff options
| author | Felix Fietkau | 2023-11-27 13:40:02 +0000 |
|---|---|---|
| committer | Felix Fietkau | 2023-11-27 13:40:05 +0000 |
| commit | a92101631c0dd2c466dfe22ffd752b36929b2f69 (patch) | |
| tree | 4fe53498e34f91d0d7711f5ad0d90d6b7c4bd54f | |
| parent | cb71f64de0eca864285e3c472b5ca4449c43ee29 (diff) | |
lib: fix avl tree lookup
The delta between IDs can be bigger than INT_MAX, causing order mismatch
in the tree and lookup failures
Signed-off-by: Felix Fietkau <nbd@nbd.name>
| -rw-r--r-- | lib.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -37,7 +37,11 @@ static void __randname(char *template) int udebug_id_cmp(const void *k1, const void *k2, void *ptr) { uint32_t id1 = (uint32_t)(uintptr_t)k1, id2 = (uint32_t)(uintptr_t)k2; - return id1 - id2; + if (id1 < id2) + return -1; + else if (id1 > id2) + return 1; + return 0; } static inline int |