/***************************************************************************
 *
 * Copyright (c) 2000, 2001 BalaBit IT Ltd, Budapest, Hungary
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: memtrace.h,v 1.3.2.3 2001/09/24 17:38:15 bazsi Exp $
 *
 ***************************************************************************/

#ifndef ZORP_MEMTRACE_H_INCLUDED
#define ZORP_MEMTRACE_H_INCLUDED

#if ENABLE_MEM_TRACE

#include <stdlib.h>

void z_mem_trace_init(void);
void z_mem_trace_stats(void);
void z_mem_trace_dump();

#define MEM_INFO(f, l) f ":" #l

#define malloc(size) z_malloc(size, MEM_INFO(__FILE__, __LINE__))
#define free(ptr) z_free(ptr, MEM_INFO(__FILE__, __LINE__))
#define realloc(ptr, size) z_realloc(ptr, size, MEM_INFO(__FILE__, __LINE__))
#define calloc(nmemb, size) z_calloc(nmemb, size, MEM_INFO(__FILE__, __LINE__))

void *z_malloc(size_t size, char *info);
void z_free(void *ptr, char *info);
void  *z_realloc(void *ptr, size_t size, char *info);
void *z_calloc(size_t nmemb, size_t size, char *info);

#else

#define z_mem_trace_init()

#endif

#endif
