summaryrefslogtreecommitdiff
path: root/src/shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared.h')
-rw-r--r--src/shared.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shared.h b/src/shared.h
index 825814e..66d1af3 100644
--- a/src/shared.h
+++ b/src/shared.h
@@ -7,6 +7,9 @@
7#define FALSE 0 7#define FALSE 0
8#define TRUE 1 8#define TRUE 1
9 9
10typedef int (*gcallback)(void*); // Generic callback signature
11typedef void (*fcallback)(void*); // free()-like callback signature
12
10#define RETURNWERR(errval, retval) do {\ 13#define RETURNWERR(errval, retval) do {\
11 errno = (errval);\ 14 errno = (errval);\
12 return (retval);\ 15 return (retval);\
@@ -60,12 +63,12 @@ char * xdirname(const char * const path);
60 63
61 64
62// Cleanup callback. Should act like `free()`, in that it doesn't crash if the pointer it's given is null 65// Cleanup callback. Should act like `free()`, in that it doesn't crash if the pointer it's given is null
63typedef void (*cleanup_callback)(void*); 66typedef fcallback cleanup_callback;
64 67
65// Cleanup struct. Stores a STATICALLY defined array of callbacks and void* arguments 68// Cleanup struct. Stores a STATICALLY defined array of callbacks and void* arguments
66typedef struct cl { 69typedef struct cl {
67 cleanup_callback *funcs; 70 cleanup_callback *funcs; // Actual type: cleanup_callback funcs[]
68 void **args; 71 void **args; // Actual type: void *args[]
69 72
70 int size; 73 int size;
71 int used; 74 int used;