Convert efree() to a macro that just casts to void * and does free().
If the system free() can't handle free(NULL) this may crash but C89 was a long time ago.
This commit is contained in:
@@ -271,13 +271,3 @@ evasprintf(char **ret, const char *format, va_list args)
|
|||||||
errorx_nodebug(1, NULL);
|
errorx_nodebug(1, NULL);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Wrapper for free(3) so we can depend on C89 semantics.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
efree(void *ptr)
|
|
||||||
{
|
|
||||||
if (ptr != NULL)
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
||||||
|
@@ -19,9 +19,11 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#undef efree
|
||||||
|
#define efree(x) free((void *)(x))
|
||||||
|
|
||||||
int easprintf(char **, const char *, ...) __printflike(2, 3);
|
int easprintf(char **, const char *, ...) __printflike(2, 3);
|
||||||
int evasprintf(char **, const char *, va_list) __printflike(2, 0);
|
int evasprintf(char **, const char *, va_list) __printflike(2, 0);
|
||||||
void efree(void *);
|
|
||||||
void *ecalloc(size_t, size_t) __malloc_like;
|
void *ecalloc(size_t, size_t) __malloc_like;
|
||||||
void *emalloc(size_t) __malloc_like;
|
void *emalloc(size_t) __malloc_like;
|
||||||
void *emalloc2(size_t, size_t) __malloc_like;
|
void *emalloc2(size_t, size_t) __malloc_like;
|
||||||
|
Reference in New Issue
Block a user