api documentation for ec_parse
[protos/libecoli.git] / src / ecoli_assert.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
3  */
4
5 #include <stdarg.h>
6 #include <stdio.h>
7 #include <stdbool.h>
8 #include <stdlib.h>
9
10 #include <ecoli_assert.h>
11
12 void __ec_assert_print(bool expr, const char *expr_str, const char *format, ...)
13 {
14         va_list ap;
15
16         if (expr)
17                 return;
18
19         /* LCOV_EXCL_START */
20         va_start(ap, format);
21         fprintf(stderr, "assertion failed: '%s' is false\n", expr_str);
22         vfprintf(stderr, format, ap);
23         va_end(ap);
24         abort();
25         /* LCOV_EXCL_END */
26 }