[polypaudio-commits] r913 - in /trunk/src/polyp: xmalloc.c xmalloc.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Wed May 17 12:07:31 PDT 2006
Author: lennart
Date: Wed May 17 21:07:30 2006
New Revision: 913
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=913&root=polypaudio&view=rev
Log:
* make pa_xfree() a real function
* update doxygen docs for xmalloc.h
Modified:
trunk/src/polyp/xmalloc.c
trunk/src/polyp/xmalloc.h
Modified: trunk/src/polyp/xmalloc.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/xmalloc.c?rev=913&root=polypaudio&r1=912&r2=913&view=diff
==============================================================================
--- trunk/src/polyp/xmalloc.c (original)
+++ trunk/src/polyp/xmalloc.c Wed May 17 21:07:30 2006
@@ -121,3 +121,9 @@
}
}
+void pa_xfree(void *p) {
+ if (!p)
+ return;
+
+ free(p);
+}
Modified: trunk/src/polyp/xmalloc.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/xmalloc.h?rev=913&root=polypaudio&r1=912&r2=913&view=diff
==============================================================================
--- trunk/src/polyp/xmalloc.h (original)
+++ trunk/src/polyp/xmalloc.h Wed May 17 21:07:30 2006
@@ -27,14 +27,29 @@
#include <limits.h>
#include <assert.h>
+/** \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);
-#define pa_xfree free
+/** 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() */
More information about the pulseaudio-commits
mailing list