6 #define DECLARE_PTRMAP(name, ktype, vtype) \
7 struct name ## _pair { ktype key; vtype val; }; \
8 struct name { struct name ## _pair block[1]; }; \
10 void name##_add(struct name **map, ktype k, vtype v) { \
11 __ptrmap_add((struct ptrmap**)map, k, v); \
14 void name##_update(struct name **map, ktype k, vtype v) { \
15 __ptrmap_update((struct ptrmap**)map, k, v); \
18 vtype name##_lookup(struct name *map, ktype k) { \
19 vtype val = __ptrmap_lookup((struct ptrmap*)map, k); \
24 void __ptrmap_add(struct ptrmap
**mapp
, void *key
, void *val
);
25 void __ptrmap_update(struct ptrmap
**mapp
, void *key
, void *val
);
26 void *__ptrmap_lookup(struct ptrmap
*map
, void *key
);