diff options
author | Test_User <hax@andrewyu.org> | 2024-06-14 05:52:27 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2024-06-14 05:52:27 -0400 |
commit | 652424e59e5c9be60a8b98912bbe40e344fe158d (patch) | |
tree | 528ed99ef2b01c632ebe258966f8beff1cd13136 /table.c | |
parent | c987c367203fca97cc90c8a5dc3d375914256b1c (diff) | |
download | coupserv-652424e59e5c9be60a8b98912bbe40e344fe158d.tar.gz coupserv-652424e59e5c9be60a8b98912bbe40e344fe158d.zip |
Another table bug fixed
Diffstat (limited to '')
-rw-r--r-- | table.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -46,10 +46,14 @@ static inline int compare(struct string a, struct string b) { int val = memcmp(a.data, b.data, len); - if (val == 0 && a.len != b.len) - return 1; - else - return val; + if (val == 0) { + if (a.len < b.len) + return 1; + else if (a.len > b.len) + return -1; + } + + return val; } static inline uint64_t search(struct table tbl, struct string name, uint8_t *exists) { |