84 while (elm != NULL && elm->key.hash < hash) { |
84 while (elm != NULL && elm->key.hash < hash) { |
85 prev = elm; |
85 prev = elm; |
86 elm = elm->next; |
86 elm = elm->next; |
87 } |
87 } |
88 |
88 |
89 if (elm == NULL || elm->key.hash != hash) { |
89 if (elm != NULL && elm->key.hash == hash) { |
|
90 // overwrite existing element |
|
91 elm->data = value; |
|
92 } else { |
|
93 // insert new element |
|
94 |
90 struct cx_hash_map_element_s *e = cxMalloc(allocator, sizeof(struct cx_hash_map_element_s)); |
95 struct cx_hash_map_element_s *e = cxMalloc(allocator, sizeof(struct cx_hash_map_element_s)); |
91 if (e == NULL) { |
96 if (e == NULL) { |
92 return -1; |
97 return -1; |
93 } |
98 } |
94 |
99 |