grafthistory: support curl
[elinks/elinks-j605.git] / src / util / memlist.h
blob5fe34ba173673e994ab527c4f63ecb48515cb0c7
1 #ifndef EL__UTIL_MEMLIST_H
2 #define EL__UTIL_MEMLIST_H
4 struct memory_list {
5 int n;
6 void *p[1];
7 };
9 #undef DEBUG_MEMLIST
10 #ifdef CONFIG_DEBUG
11 #define DEBUG_MEMLIST
12 #endif
14 #if defined(DEBUG_MEMLIST) && defined(HAVE_VARIADIC_MACROS)
15 struct memory_list *debug_getml(unsigned char *file, int line, void *p, ...);
16 void debug_add_to_ml(unsigned char *file, int line, struct memory_list **ml, ...);
17 #define getml(...) debug_getml(__FILE__, __LINE__, __VA_ARGS__)
18 #define add_to_ml(...) debug_add_to_ml(__FILE__, __LINE__, __VA_ARGS__)
19 #else
20 struct memory_list *getml(void *p, ...);
21 void add_to_ml(struct memory_list **ml, ...);
22 #endif
24 #ifdef DEBUG_MEMLIST
25 void debug_add_one_to_ml(unsigned char *file, int line, struct memory_list **ml, void *p);
26 #define add_one_to_ml(ml, p) debug_add_one_to_ml(__FILE__, __LINE__, ml, p)
27 #else
28 void add_one_to_ml(struct memory_list **ml, void *p);
29 #endif
31 void freeml(struct memory_list *);
33 #endif