summaryrefslogtreecommitdiffstats
path: root/polyp/xmalloc.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-11-04 18:57:31 +0000
committerLennart Poettering <lennart@poettering.net>2004-11-04 18:57:31 +0000
commit344ced4622ffc9d38ab0388d3ed44fe55ce5e86c (patch)
treeff40fab27b0a63c1857496d7eeb2af66c2cdeca4 /polyp/xmalloc.c
parent1f6a90c963356d3889cce4717a1a6b03cb039254 (diff)
add some more comments
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@271 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/xmalloc.c')
-rw-r--r--polyp/xmalloc.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/polyp/xmalloc.c b/polyp/xmalloc.c
index 47f46bbe..709e46e5 100644
--- a/polyp/xmalloc.c
+++ b/polyp/xmalloc.c
@@ -30,19 +30,22 @@
#include "memory.h"
#include "util.h"
-#define MAX_ALLOC_SIZE (1024*1024*20)
+/* Make sure not to allocate more than this much memory. */
+#define MAX_ALLOC_SIZE (1024*1024*20) /* 20MB */
-#undef malloc
-#undef free
-#undef realloc
-#undef strndup
-#undef strdup
+/* #undef malloc */
+/* #undef free */
+/* #undef realloc */
+/* #undef strndup */
+/* #undef strdup */
+/** called in case of an OOM situation. Prints an error message and
+ * exits */
static void oom(void) {
static const char e[] = "Not enough memory\n";
- pa_loop_write(2, e, sizeof(e)-1);
+ pa_loop_write(STDERR_FILENO, e, sizeof(e)-1);
raise(SIGQUIT);
- exit(1);
+ _exit(1);
}
void* pa_xmalloc(size_t size) {