-
Notifications
You must be signed in to change notification settings - Fork 119
Custom type data #12
Comments
Hi zxyAcmen, Declaration: I am not the author nor the maintainer of this project. static map_node_t *map_newnode(const char *key, void *value, int vsize) {
map_node_t *node;
int ksize = strlen(key) + 1;
int voffset = ksize + ((sizeof(void*) - ksize) % sizeof(void*));
node = malloc(sizeof(*node) + voffset + vsize);
if (!node) return NULL;
memcpy(node + 1, key, ksize);
node->hash = map_hash(key);
node->value = ((char*) (node + 1)) + voffset;
memcpy(node->value, value, vsize);
return node;
} 声明:我不是该项目的作者和维护者。 这个Map通过哈希表来储存数据。当你把key和value传进 |
// 正确的使用方法如下,如果涉及到动态分配的数据类型,不建议使用此库。 #define CRTDBG_MAP_ALLOC #include <stdio.h> #include <map/map.h> struct Man int main(int argc, char* argv[], char* env[])
} |
Hello, I learned your map code,After applying for space on the heap, calling map ﹣ deinit ﹣ will not release the empty space applied by the user. It is not very clear about this. If you want to request, email: [email protected], QQ: 8101309. If you can, can you direct me.
中文:您好,我学习了你的map代码,请问自定数据类型在堆上申请空间后,调用map_deinit_后不会释放用户自己申请的空吧,对这块不是很清楚,想请求下, 邮箱:[email protected],qq:8101309 如果可以的话能否直接指点下。
The text was updated successfully, but these errors were encountered: