From 0730fc3924dd4e04efbe51287d1d69850404d05f Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 31 Jan 2016 19:53:45 -0500 Subject: bump version to 0.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 --- src/hash.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/hash.c') diff --git a/src/hash.c b/src/hash.c index da15157..23e4bba 100644 --- a/src/hash.c +++ b/src/hash.c @@ -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; +} -- cgit v1.1