aboutsummaryrefslogtreecommitdiff
path: root/src/std/hash_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/std/hash_map.c')
-rw-r--r--src/std/hash_map.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/std/hash_map.c b/src/std/hash_map.c
index bcb43eb..c2e42c1 100644
--- a/src/std/hash_map.c
+++ b/src/std/hash_map.c
@@ -205,13 +205,12 @@ bool hash_map_get(HashMap *self, BufferView key, void *value) {
int hash_map_compare_string(const void *a, const void *b) {
const BufferView *lhs;
const BufferView *rhs;
- int mem_diff;
lhs = a;
rhs = b;
- mem_diff = am_memcmp(lhs->data, rhs->data, MIN(lhs->size, rhs->size));
- if(mem_diff == 0)
- return (int)lhs->size - (int)rhs->size;
- else
- return mem_diff;
+
+ if(lhs->size != rhs->size)
+ return -1;
+
+ return am_memcmp(lhs->data, rhs->data, MIN(lhs->size, rhs->size));
}