blob: 94b39f757b1dfa609ff7f9089a9b4d78215f4697 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#ifndef KRB5_CLEANUP
#define KRB5_CLEANUP
struct cleanup {
void * arg;
void (*func)(void *);
};
#define CLEANUP_INIT(x) \
struct cleanup cleanup_data[x]; \
int cleanup_count = 0;
#define CLEANUP_PUSH(x, y) \
cleanup_data[cleanup_count].arg = x; \
cleanup_data[cleanup_count].func = y; \
cleanup_count++;
#define CLEANUP_POP(x) \
if ((--cleanup_count) && x && (cleanup_data[cleanup_count].func)) \
cleanup_data[cleanup_count].func(cleanup_data[cleanup_count].arg);
#define CLEANUP_DONE() \
while(cleanup_count--) \
if (cleanup_data[cleanup_count].func) \
cleanup_data[cleanup_count].func(cleanup_data[cleanup_count].arg);
#endif
|