diff options
author | Peter Johnson <peter@tortall.net> | 2003-03-12 06:08:43 +0000 |
---|---|---|
committer | Peter Johnson <peter@tortall.net> | 2003-03-12 06:08:43 +0000 |
commit | 84ee559be753fa15a208e8b176c254446d26847b (patch) | |
tree | 4420d8294b1ed9cd9ae9bcb68151e8b5bc82838c /util.h | |
parent | d9f68d6d4b92febb4e9c6e7e58c28369bee392dd (diff) | |
download | yasm-84ee559be753fa15a208e8b176c254446d26847b.tar.gz |
The Great Renaming (prefixing with yasm_), Part 2: allocation functions.
svn path=/trunk/yasm/; revision=843
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -126,21 +126,33 @@ int yasm__strncasecmp(const char *s1, const char *s2, size_t n); # endif #endif +#ifdef WITH_DMALLOC +# include <dmalloc.h> + +#define yasm__xstrdup(str) xstrdup(str) +#define yasm_xmalloc(size) xmalloc(size) +#define yasm_xcalloc(count, size) xcalloc(count, size) +#define yasm_xrealloc(ptr, size) xrealloc(ptr, size) +#define yasm_xfree(ptr) xfree(ptr) + +#else /* strdup() implementation with error checking (using xmalloc). */ -/*@only@*/ char *xstrdup(const char *str); +/*@only@*/ char *yasm__xstrdup(const char *str); -/* Error-checking memory allocation routines in xmalloc.c. */ -/*@only@*/ /*@out@*/ void *xmalloc(size_t size); -/*@only@*/ void *xcalloc(size_t nelem, size_t elsize); -/*@only@*/ void *xrealloc(/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ - void *oldmem, size_t size) /*@modifies oldmem@*/; -void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/; +/* Error-checking memory allocation routines. Default implementations in + * xmalloc.c. + */ +extern /*@only@*/ /*@out@*/ void * (*yasm_xmalloc) (size_t size); +extern /*@only@*/ void * (*yasm_xcalloc) (size_t nelem, size_t elsize); +extern /*@only@*/ void * (*yasm_xrealloc) + (/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size) + /*@modifies oldmem@*/; +extern void (*yasm_xfree) (/*@only@*/ /*@out@*/ /*@null@*/ void *p) + /*@modifies p@*/; -#ifdef WITH_DMALLOC -# include <dmalloc.h> #endif -/*@only@*/ char *xstrndup(const char *str, size_t len); +/*@only@*/ char *yasm__xstrndup(const char *str, size_t len); /* Bit-counting: used primarily by HAMT but also in a few other places. */ #define SK5 0x55555555 |