src/server/daemon/func.c

changeset 574
76450adae540
parent 490
d218607f5a7e
child 579
e10457d74fe1
equal deleted inserted replaced
573:76ccfc2a932f 574:76450adae540
36 36
37 #include "func.h" 37 #include "func.h"
38 38
39 CxMap *function_map; 39 CxMap *function_map;
40 40
41 static void funcstruct_free(FuncStruct *f) {
42 free((char*)f->name);
43 free(f);
44 }
45
41 void func_init() { 46 void func_init() {
42 function_map = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 256); 47 function_map = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 256);
48 function_map->simple_destructor = (cx_destructor_func)funcstruct_free;
49 }
50
51 void func_cleanup() {
52 cxMapDestroy(function_map);
43 } 53 }
44 54
45 void add_function(FuncStruct *func) { 55 void add_function(FuncStruct *func) {
46 struct FuncStruct *f = malloc(sizeof(FuncStruct)); 56 struct FuncStruct *f = malloc(sizeof(FuncStruct));
47 *f = *func; 57 *f = *func;

mercurial