dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / gss_mechs / mech_krb5 / krb5 / krb / cleanup.h
blob67a709689a0b7ddd83d72936c4b349457d573046
1 #pragma ident "%Z%%M% %I% %E% SMI"
3 #ifndef KRB5_CLEANUP
4 #define KRB5_CLEANUP
6 struct cleanup {
7 void * arg;
8 void (*func)(void *);
9 };
11 #define CLEANUP_INIT(x) \
12 struct cleanup cleanup_data[x]; \
13 int cleanup_count = 0;
15 #define CLEANUP_PUSH(x, y) \
16 cleanup_data[cleanup_count].arg = x; \
17 cleanup_data[cleanup_count].func = y; \
18 cleanup_count++;
20 #define CLEANUP_POP(x) \
21 if ((--cleanup_count) && x && (cleanup_data[cleanup_count].func)) \
22 cleanup_data[cleanup_count].func(cleanup_data[cleanup_count].arg);
24 #define CLEANUP_DONE() \
25 while(cleanup_count--) \
26 if (cleanup_data[cleanup_count].func) \
27 cleanup_data[cleanup_count].func(cleanup_data[cleanup_count].arg);
30 #endif