1.1 --- a/ucx/map.c Thu Oct 04 18:23:32 2012 +0200 1.2 +++ b/ucx/map.c Thu Oct 04 18:46:57 2012 +0200 1.3 @@ -4,9 +4,6 @@ 1.4 1.5 #include <stdlib.h> 1.6 #include <string.h> 1.7 -#ifndef _WIN32 1.8 -#include <unistd.h> 1.9 -#endif /* not _WIN32 */ 1.10 1.11 #include "map.h" 1.12 1.13 @@ -42,6 +39,16 @@ 1.14 free(map); 1.15 } 1.16 1.17 +UcxMap *ucx_map_clone(UcxMap *map, copy_func fnc, void *data) { 1.18 + UcxMap *newmap = ucx_map_new(map->size); 1.19 + UcxMapIterator i = ucx_map_iterator(map); 1.20 + void *value; 1.21 + UCX_MAP_FOREACH(value, i) { 1.22 + ucx_map_put(newmap, i.cur->key, fnc ? fnc(value, data) : value); 1.23 + } 1.24 + return newmap; 1.25 +} 1.26 + 1.27 int ucx_map_put(UcxMap *map, UcxKey key, void *data) { 1.28 if(key.hash == 0) { 1.29 key.hash = ucx_hash((char*)key.data, key.len);