X-Git-Url: https://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/8456fd3535202bc2b79df4ddb794cbfd075054fd..HEAD:/src/misc.h diff --git a/src/misc.h b/src/misc.h index d7a7605..e8ba447 100644 --- a/src/misc.h +++ b/src/misc.h @@ -6,11 +6,15 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) -/** _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, - * and offset > *current, perform the seek by reading (and discarding) data. - */ -int _lbx_fseek(FILE *f, long *current, size_t offset); +#ifndef NDEBUG +# define _lbx_dbgprint(str) (fprintf(stderr, str " [%s, %s:%d]\n", \ + __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 #endif