* make pa_xfree() a real function

* update doxygen docs for xmalloc.h


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@913 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-05-17 19:07:30 +00:00
parent 6e9f2d7093
commit 56d8e56431
2 changed files with 25 additions and 4 deletions

View file

@ -121,3 +121,9 @@ char *pa_xstrndup(const char *s, size_t l) {
}
}
void pa_xfree(void *p) {
if (!p)
return;
free(p);
}

View file

@ -27,14 +27,29 @@
#include <limits.h>
#include <assert.h>
void* pa_xmalloc(size_t l);
void *pa_xmalloc0(size_t l);
void *pa_xrealloc(void *ptr, size_t size);
#define pa_xfree free
/** \file
* Memory allocation functions.
*/
/** Allocate the specified number of bytes, just like malloc() does. However, in case of OOM, terminate */
void* pa_xmalloc(size_t l);
/** Same as pa_xmalloc(), but initialize allocated memory to 0 */
void *pa_xmalloc0(size_t l);
/** The combination of pa_xmalloc() and realloc() */
void *pa_xrealloc(void *ptr, size_t size);
/** Free allocated memory */
void pa_xfree(void *p);
/** Duplicate the specified string, allocating memory with pa_xmalloc() */
char *pa_xstrdup(const char *s);
/** Duplicate the specified string, but truncate after l characters */
char *pa_xstrndup(const char *s, size_t l);
/** Duplicate the specified memory block */
void* pa_xmemdup(const void *p, size_t l);
/** Internal helper for pa_xnew() */