xalloc: do not implement xfree() function in non-debug mode.
all it does is add another function call in that situation.
This commit is contained in:
parent
e0f29b6a45
commit
a973415f0e
2 changed files with 7 additions and 2 deletions
|
|
@ -8,7 +8,6 @@
|
|||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "util.h"
|
||||
|
|
@ -84,8 +83,10 @@ void* xmemdup(const void *src, size_t size) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
#ifdef __DEBUG__
|
||||
void xfree(void *ptr) {
|
||||
|
||||
CHECK_INPUT(ptr, "xfree");
|
||||
free(ptr);
|
||||
}
|
||||
#endif /* __DEBUG__ */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef __XALLOC_H
|
||||
#define __XALLOC_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void* xmalloc(size_t);
|
||||
|
||||
|
|
@ -23,6 +23,10 @@ char* xstrdup(const char *);
|
|||
|
||||
void* xmemdup(const void *, size_t);
|
||||
|
||||
#ifdef __DEBUG__
|
||||
void xfree(void *);
|
||||
#else
|
||||
#define xfree free
|
||||
#endif /* __DEBUG__ */
|
||||
|
||||
#endif /* __XALLOC_H */
|
||||
|
|
|
|||
Reference in a new issue