diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2016-01-31 19:53:45 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2016-01-31 19:53:45 -0500 |
| commit | 0730fc3924dd4e04efbe51287d1d69850404d05f (patch) | |
| tree | 495d79d0dc26e39c9065c6ceb7d16b9a3e76561d /src/hash.c | |
| parent | 8405274a91e3652ee98a423608a8496ead1edc05 (diff) | |
| download | netcosm-0.5.0-rc1.zip netcosm-0.5.0-rc1.tar.gz netcosm-0.5.0-rc1.tar.bz2 netcosm-0.5.0-rc1.tar.xz | |
bump version to 0.5.0-rc10.5.0-rc1
* implements objects using reference counts rather than copying
* implements both room-local and global verbs
* refactors the world_* functions into a separate module
* numerous other changes
Diffstat (limited to 'src/hash.c')
| -rw-r--r-- | src/hash.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -34,6 +34,7 @@ struct hash_map { size_t table_sz; void (*free_key)(void *key); void (*free_data)(void *data); + void* (*dup_data)(void *data); size_t n_entries; }; @@ -279,7 +280,15 @@ void *hash_dup(void *ptr) if(!data) break; ptr = NULL; + if(map->dup_data) + data = map->dup_data(data); hash_insert(ret, key, data); } return ret; } + +void hash_setdupdata_cb(void *ptr, void *(*cb)(void*)) +{ + struct hash_map *map = ptr; + map->dup_data = cb; +} |