mk.h

#ifndef MK_H
#define MK_H 1

#include <stdlib.h> /* needed by malloc-check */
#include <string.h>

/* this does double evals, but rolling our own assert() isn't the point */
#include <assert.h>
#define ASSERT(x) assert(x)
#ifndef NDEBUG
# define assert_ret(x, y) assert(x)
# define ASSERT_RET(x, y) assert(x)
#else
# define assert_ret(x, y) if (x) {} else return y
# define ASSERT_RET(x, y) if (x) {} else return y
#endif

#define TRUE  1
#define FALSE 0

# define MK(sz)                                 \
    malloc_check_malloc(sz, __FILE__, __LINE__)
# define M0(num, sz)                                    \
    malloc_check_calloc(num, sz, __FILE__, __LINE__)
# define MV(ptr, tmp, sz)                                               \
    (((tmp) = malloc_check_realloc(ptr, sz, __FILE__, __LINE__)) &&     \
     ((ptr) = (tmp)))
# define F(ptr)                                 \
    malloc_check_free(ptr)

#include "malloc-check.h"

#endif