1 module pulse.xmalloc;
2 
3 version(linux):
4 
5 extern (C):
6 
7 /***
8   This file is part of PulseAudio.
9 
10   Copyright 2004-2006 Lennart Poettering
11 
12   PulseAudio is free software; you can redistribute it and/or modify
13   it under the terms of the GNU Lesser General Public License as published
14   by the Free Software Foundation; either version 2.1 of the License,
15   or (at your option) any later version.
16 
17   PulseAudio is distributed in the hope that it will be useful, but
18   WITHOUT ANY WARRANTY; without even the implied warranty of
19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20   General Public License for more details.
21 
22   You should have received a copy of the GNU Lesser General Public License
23   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
24 ***/
25 
26 /** \file
27  * Memory allocation functions.
28  */
29 
30 /** Allocate the specified number of bytes, just like malloc() does. However, in case of OOM, terminate */
31 void* pa_xmalloc (size_t l);
32 
33 /** Same as pa_xmalloc(), but initialize allocated memory to 0 */
34 void* pa_xmalloc0 (size_t l);
35 
36 /**  The combination of pa_xmalloc() and realloc() */
37 void* pa_xrealloc (void* ptr, size_t size);
38 
39 /** Free allocated memory */
40 void pa_xfree (void* p);
41 
42 /** Duplicate the specified string, allocating memory with pa_xmalloc() */
43 char* pa_xstrdup (const(char)* s);
44 
45 /** Duplicate the specified string, but truncate after l characters */
46 char* pa_xstrndup (const(char)* s, size_t l);
47 
48 /** Duplicate the specified memory block */
49 void* pa_xmemdup (const(void)* p, size_t l);
50 
51 /** Internal helper for pa_xnew() */
52 void* _pa_xnew_internal (size_t n, size_t k);
53 
54 void* _pa_xnew_internal (size_t n, size_t k);
55 
56 /** Allocate n new structures of the specified type. */
57 
58 /** Internal helper for pa_xnew0() */
59 void* _pa_xnew0_internal (size_t n, size_t k);
60 
61 void* _pa_xnew0_internal (size_t n, size_t k);
62 
63 /** Same as pa_xnew() but set the memory to zero */
64 
65 /** Internal helper for pa_xnew0() */
66 void* _pa_xnewdup_internal (const(void)* p, size_t n, size_t k);
67 
68 void* _pa_xnewdup_internal (const(void)* p, size_t n, size_t k);
69 
70 /** Same as pa_xnew() but duplicate the specified data */
71 
72 /** Internal helper for pa_xrenew() */
73 void* _pa_xrenew_internal (void* p, size_t n, size_t k);
74 
75 void* _pa_xrenew_internal (void* p, size_t n, size_t k);
76 
77 /** Reallocate n new structures of the specified type. */
78