/*1Wrappers for malloc(), calloc(), free(), realloc().234AUTHORS:56- Jeroen Demeyer (2011-01-13): initial version (#10258)78*/910/*****************************************************************************11* Copyright (C) 2011 Jeroen Demeyer <[email protected]>12*13* Distributed under the terms of the GNU General Public License (GPL)14* as published by the Free Software Foundation; either version 2 of15* the License, or (at your option) any later version.16* http://www.gnu.org/licenses/17****************************************************************************/1819#ifndef C_LIB_INCLUDE_MEMORY_H20#define C_LIB_INCLUDE_MEMORY_H2122#include "interrupt.h"2324#ifdef __cplusplus25extern "C" {26#endif2728static inline void* sage_malloc(size_t n)29{30sig_block();31void* ret = malloc(n);32sig_unblock();33return ret;34}35static inline void* sage_calloc(size_t nmemb, size_t size)36{37sig_block();38void* ret = calloc(nmemb, size);39sig_unblock();40return ret;41}42static inline void sage_free(void* ptr)43{44sig_block();45free(ptr);46sig_unblock();47}48static inline void* sage_realloc(void *ptr, size_t size)49{50sig_block();51void* ret = realloc(ptr, size);52sig_unblock();53return ret;54}5556void init_memory_functions();575859#ifdef __cplusplus60} /* extern "C" */61#endif62#endif /* C_LIB_INCLUDE_MEMORY_H */636465