#ifndef _MSHELL_H_
#define _MSHELL_H_
#ifdef __cplusplus
extern "C" {
#endif
extern void* mem_malloc(size_t, char const*, const int) is_MALLOC returns_NONNULL;
extern void* mem_calloc(size_t, size_t, char const*, const int) is_MALLOC returns_NONNULL;
extern void* mem_realloc(void*, size_t, char const*, const int) is_MALLOC returns_NONNULL;
extern char* mem_strdup(char const*, char const*, const int) is_MALLOC returns_NONNULL;
extern void mem_free(void*, char const*, const int);
#ifndef _MSHELL_C_
#ifdef strdup
#undef strdup
#endif
#define malloc(a) mem_malloc((a), __FILE__, __LINE__)
#define calloc(a, b) mem_calloc((a), (b), __FILE__, __LINE__)
#define realloc(a, b) mem_realloc((a), (b), __FILE__, __LINE__)
#define strdup(a) mem_strdup((a), __FILE__, __LINE__)
#define free(a) mem_free((a), __FILE__, __LINE__)
#endif
#ifndef NO_MSHELL
extern size_t mem_used(void) is_PURE;
extern void mem_maximum(FILE* fp);
extern void mem_display(FILE* fp);
extern void mem_check_x(void const* p, char const* file, const int line);
extern void mem_check_all_x(char const* file, const int line);
extern void mem_hide_x(void* p, char const* file, const int line);
#define mem_check(a) mem_check_x(a, __FILE__, __LINE__)
#define mem_check_all() mem_check_all_x(__FILE__, __LINE__)
#define mem_hide(a) mem_hide_x(a, __FILE__, __LINE__)
#else
#define mem_used()
#define mem_maximum(a)
#define mem_display(a)
#define mem_check(a)
#define mem_check_all()
#define mem_hide(a)
#endif
#ifdef __cplusplus
}
#endif
#endif