X-Git-Url: https://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/210202b952fe47685635f812d85779f7a8ce5354..ea9655907d37782a2a505caee22f2458058784ee:/src/misc.h diff --git a/src/misc.h b/src/misc.h index d7a7605..5e5947a 100644 --- a/src/misc.h +++ b/src/misc.h @@ -1,11 +1,26 @@ #ifndef LBX_MISC_H_ #define LBX_MISC_H_ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) +#ifndef NDEBUG +# define _lbx_dbgprint(str) (fprintf(stderr, str " [%s, %s:%d]", \ + __func__, __FILE__, __LINE__)) +# define _lbx_assert(expr) ((!(expr)) \ + ? (_lbx_dbgprint("format assertion failed: " #expr), 0) \ + : 1) +#else +# define _lbx_dbgprint(str) 0 +# define _lbx_assert(expr) ((expr) ? 1 : 0) +#endif + /** _lbx_fseek() * Seeks the specified file to the specified offset, given that the file is * currently positioned at *current. If the file does not support seeking,