X-Git-Url: https://code.delx.au/pulseaudio/blobdiff_plain/22cb23eedb2eae7c79dc8fcf395be08bfc666256..fa499dad06ba6558111cdef64c18f2401e803cff:/polyp/xmalloc.c diff --git a/polyp/xmalloc.c b/polyp/xmalloc.c index 7d8b4821..7ddefa94 100644 --- a/polyp/xmalloc.c +++ b/polyp/xmalloc.c @@ -1,23 +1,52 @@ +/* $Id$ */ + +/*** + This file is part of polypaudio. + + polypaudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2 of the License, + or (at your option) any later version. + + polypaudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with polypaudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include +#include #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) {