mirror of
https://github.com/nothings/stb
synced 2024-12-15 12:22:55 +03:00
Fix temp_key being stale on key re-insert
See issue #992 and pull request #993.
This commit is contained in:
parent
c9064e3176
commit
63e4ada98c
2
stb_ds.h
2
stb_ds.h
@ -1378,6 +1378,8 @@ void *stbds_hmput_key(void *a, size_t elemsize, void *key, size_t keysize, int m
|
||||
if (bucket->hash[i] == hash) {
|
||||
if (stbds_is_key_equal(raw_a, elemsize, key, keysize, keyoffset, mode, bucket->index[i])) {
|
||||
stbds_temp(a) = bucket->index[i];
|
||||
if (mode >= STBDS_HM_STRING)
|
||||
stbds_temp_key(a) = * (char **) ((char *) raw_a + elemsize*bucket->index[i] + keyoffset);
|
||||
return STBDS_ARR_TO_HASH(a,elemsize);
|
||||
}
|
||||
} else if (bucket->hash[i] == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user