uhub/src/util/memory.h

48 lines
1.4 KiB
C
Raw Normal View History

2009-02-19 16:14:09 +00:00
/*
* uhub - A tiny ADC p2p connection hub
2010-07-10 01:41:49 +00:00
* Copyright (C) 2007-2010, Jan Vidar Krey
2009-02-19 16:14:09 +00:00
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef HAVE_UHUB_MEMORY_HANDLER_H
#define HAVE_UHUB_MEMORY_HANDLER_H
#ifdef MEMORY_DEBUG
#define hub_malloc debug_mem_malloc
#define hub_free debug_mem_free
#define hub_strdup debug_mem_strdup
#define hub_strndup debug_mem_strndup
extern void* debug_mem_malloc(size_t size);
extern void debug_mem_free(void* ptr);
extern char* debug_mem_strdup(const char* s);
extern char* debug_mem_strndup(const char* s, size_t n);
#else
#define hub_malloc malloc
#define hub_free free
#define hub_realloc realloc
2009-02-19 16:14:09 +00:00
#define hub_strdup strdup
#define hub_strndup strndup
2009-02-19 16:14:09 +00:00
#endif
extern void* hub_malloc_zero(size_t size);
#endif /* HAVE_UHUB_MEMORY_HANDLER_H */