From 8a1c3461bb820bf875a50be56c7652177cf50645 Mon Sep 17 00:00:00 2001 From: axtloss Date: Tue, 16 Jul 2024 02:28:06 +0200 Subject: fix formatting --- src/constraint_handler.c | 55 +++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'src/constraint_handler.c') diff --git a/src/constraint_handler.c b/src/constraint_handler.c index 450632e..5506ab0 100644 --- a/src/constraint_handler.c +++ b/src/constraint_handler.c @@ -11,41 +11,44 @@ static constraint_handler_t *_cnstrnt_handler = NULL; constraint_handler_t set_constraint_handler_s (constraint_handler_t handler) { - constraint_handler_t *new, *old, ret; - - new = malloc (sizeof (constraint_handler_t)); - if (!new) return NULL; - *new = handler; - old = _cnstrnt_handler; - _cnstrnt_handler = new; - if (!old) - ret = NULL; - else { - ret = *old; - free (old); - } - return ret; + constraint_handler_t *new, *old, ret; + + new = malloc (sizeof (constraint_handler_t)); + if (!new) + return NULL; + *new = handler; + old = _cnstrnt_handler; + _cnstrnt_handler = new; + if (!old) + ret = NULL; + else + { + ret = *old; + free (old); + } + return ret; } void -throw_constraint_handler_s (const char * restrict msg, errno_t error) +throw_constraint_handler_s (const char *restrict msg, errno_t error) { - constraint_handler_t ch; - ch = _cnstrnt_handler != NULL ? *_cnstrnt_handler : NULL; - if (ch != NULL) - ch (msg, NULL, error); + constraint_handler_t ch; + ch = _cnstrnt_handler != NULL ? *_cnstrnt_handler : NULL; + if (ch != NULL) + ch (msg, NULL, error); } void -abort_handler_s (const char *restrict msg, void * restrict ptr, errno_t error) +abort_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) { - static const char abrt_msg[] = "abort_handler: "; + static const char abrt_msg[] = "abort_handler: "; - fprintf (stderr, "%s", abrt_msg); - fprintf (stderr, "%s\n", msg); - abort (); + fprintf (stderr, "%s", abrt_msg); + fprintf (stderr, "%s\n", msg); + abort (); } void -ignore_handler_s (const char * restrict msg, void * restrict ptr, errno_t error) -{} +ignore_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) +{ +} -- cgit v1.2.3