aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-14 05:52:27 -0400
committerTest_User <hax@andrewyu.org>2024-06-14 05:52:27 -0400
commit652424e59e5c9be60a8b98912bbe40e344fe158d (patch)
tree528ed99ef2b01c632ebe258966f8beff1cd13136
parentc987c367203fca97cc90c8a5dc3d375914256b1c (diff)
downloadcoupserv-652424e59e5c9be60a8b98912bbe40e344fe158d.tar.gz
coupserv-652424e59e5c9be60a8b98912bbe40e344fe158d.zip
Another table bug fixed
-rw-r--r--table.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/table.c b/table.c
index 3e8c7f1..f234717 100644
--- a/table.c
+++ b/table.c
@@ -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) {