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