]> git.draconx.ca Git - liblbx.git/blob - src/misc.h
839908e3e81d3f124c6d087b7a19ab4c1786c2f0
[liblbx.git] / src / misc.h
1 #ifndef LBX_MISC_H_
2 #define LBX_MISC_H_
3
4 #ifdef HAVE_CONFIG_H
5 #       include "config.h"
6 #endif
7
8 #include <stdio.h>
9
10 #define MIN(a,b) (((a)<(b))?(a):(b))
11 #define MAX(a,b) (((a)>(b))?(a):(b))
12
13 #ifndef NDEBUG
14 #       define _lbx_dbgprint(str) (fprintf(stderr, str " [%s, %s:%d]\n", \
15                                           __func__, __FILE__, __LINE__))
16 #       define _lbx_assert(expr) ((!(expr)) \
17                 ? (_lbx_dbgprint("format assertion failed: " #expr), 0) \
18                 : 1)
19 #else
20 #       define _lbx_dbgprint(str) 0
21 #       define _lbx_assert(expr) ((expr) ? 1 : 0)
22 #endif
23
24 #endif