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