aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-24 20:37:08 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-24 20:37:08 -0400
commitb3ad05094b4e778d92a351a743cdf15e7bd990b2 (patch)
treef3b45d636746929e89777c53de51c950c2c1c6b4 /utils.c
parent559a1b012a45fd37faad444050e1de733bbf109f (diff)
Autoformatting with clang-format
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/utils.c b/utils.c
index e94658c..fd258d2 100644
--- a/utils.c
+++ b/utils.c
@@ -15,8 +15,7 @@
// If the given argument is nonnegative, print the error message and exit with
// failure. Otherwise, return the given argument.
//
-int check_nonnegative(int negative_err, const char *err_msg, ...)
-{
+int check_nonnegative(int negative_err, const char *err_msg, ...) {
if (negative_err < 0) {
va_list args;
va_start(args, err_msg);
@@ -30,8 +29,7 @@ int check_nonnegative(int negative_err, const char *err_msg, ...)
// If the given argument is NULL, print the error message and exit with
// failure. Otherwise return the given argument.
//
-void *check_nonnull(void *p, const char *err_msg, ...)
-{
+void *check_nonnull(void *p, const char *err_msg, ...) {
if (p == NULL) {
va_list args;
va_start(args, err_msg);
@@ -46,11 +44,10 @@ void *check_nonnull(void *p, const char *err_msg, ...)
// the pointer to NULL. (This is a safer alternative to free() that
// automatically NULLs out the pointer so it can't be used after freeing)
//
-void delete(void *p)
-{
- if (*(void**)p != NULL) {
- free(*(void**)p);
- *(void**)p = NULL;
+void delete(void *p) {
+ if (*(void **)p != NULL) {
+ free(*(void **)p);
+ *(void **)p = NULL;
}
}