summaryrefslogtreecommitdiff
path: root/src/shared.h
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2025-06-09 15:03:19 -0500
committer@syxhe <https://t.me/syxhe>2025-06-09 15:03:19 -0500
commit534a492f2c0bcceac52a287b03dc1ff5eb0b0763 (patch)
tree0869f59e77d5b127b84e2a22015148ce9a8a3c98 /src/shared.h
parent08fb644c7d101551edfe8fc2608e0ac501b3df9f (diff)
Trim more fat, add some doxygen markup to the threadpool functions
Diffstat (limited to 'src/shared.h')
-rw-r--r--src/shared.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared.h b/src/shared.h
index efb95ad..3ff7b2d 100644
--- a/src/shared.h
+++ b/src/shared.h
@@ -3,11 +3,11 @@
3 3
4#include <stddef.h> 4#include <stddef.h>
5 5
6#define STATIC_ARRAY_LEN(arr) (sizeof((arr))/sizeof((arr)[0]))
7
8typedef int (*gcallback)(void*); // Generic callback signature 6typedef int (*gcallback)(void*); // Generic callback signature
9typedef void (*fcallback)(void*); // free()-like callback signature 7typedef void (*fcallback)(void*); // free()-like callback signature
10 8
9#define STATIC_ARRAY_LEN(arr) (sizeof((arr))/sizeof((arr)[0]))
10
11#define ERRRET(errval, retval) do {\ 11#define ERRRET(errval, retval) do {\
12 errno = (errval);\ 12 errno = (errval);\
13 return (retval);\ 13 return (retval);\
@@ -37,6 +37,7 @@ typedef void (*fcallback)(void*); // free()-like callback signature
37 37
38// Error macro that gcc will not complain about 38// Error macro that gcc will not complain about
39#define ERROR(status, errnum, format, ...) do {error((status), (errnum), (format)__VA_ARGS__); exit((status));} while (0) 39#define ERROR(status, errnum, format, ...) do {error((status), (errnum), (format)__VA_ARGS__); exit((status));} while (0)
40// Spit out a warning using `error`
40#define WARN(errnum, format, ...) do {error(0, (errnum), (format)__VA_ARGS__);} while (0) 41#define WARN(errnum, format, ...) do {error(0, (errnum), (format)__VA_ARGS__);} while (0)
41 42
42// Read the entire contents of a file descriptor into a malloc()'ed buffer 43// Read the entire contents of a file descriptor into a malloc()'ed buffer