aboutsummaryrefslogtreecommitdiff
path: root/src/constraint_handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/constraint_handler.c')
-rw-r--r--src/constraint_handler.c55
1 files changed, 29 insertions, 26 deletions
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)
+{
+}