diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-12 09:48:55 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | ea97370f973374f863e4296c2bb872be8b5235a3 (patch) | |
tree | bcf74846c250dd5b1f84049622ed2766605365e7 /src/std | |
parent | 4ca3b74621c3608de42a91730a71892d9d7c27b5 (diff) |
Before interpreter. Cleanup build script. Begin writing code analyzer tool to find common mistakes
Diffstat (limited to 'src/std')
-rw-r--r-- | src/std/hash_map.c | 11 |
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)); } |