Debian Codegraph @

deps/libneon/doc/ref/alloc.xml

raw
1 <refentry id="refalloc">
2
3 <refmeta>
4 <refentrytitle>ne_malloc</refentrytitle>
5 <manvolnum>3</manvolnum>
6 </refmeta>
7
8 <refnamediv>
9 <refname id="ne_malloc">ne_malloc</refname>
10 <refname id="ne_calloc">ne_calloc</refname>
11 <refname id="ne_realloc">ne_realloc</refname>
12 <refname id="ne_strdup">ne_strdup</refname>
13 <refname id="ne_strndup">ne_strndup</refname>
14 <refname id="ne_oom_callback">ne_oom_callback</refname>
15 <refpurpose>memory allocation wrappers</refpurpose>
16 </refnamediv>
17
18 <refsynopsisdiv>
19
20 <funcsynopsis>
21
22 <funcsynopsisinfo>#include &lt;ne_alloc.h&gt;</funcsynopsisinfo>
23
24 <funcprototype>
25 <funcdef>void *<function>ne_malloc</function></funcdef>
26 <paramdef>size_t <parameter>size</parameter></paramdef>
27 </funcprototype>
28
29 <funcprototype>
30 <funcdef>void *<function>ne_calloc</function></funcdef>
31 <paramdef>size_t <parameter>size</parameter></paramdef>
32 </funcprototype>
33
34 <funcprototype>
35 <funcdef>void *<function>ne_realloc</function></funcdef>
36 <paramdef>void *<parameter>size</parameter></paramdef>
37 <paramdef>size_t <parameter>len</parameter></paramdef>
38 </funcprototype>
39
40 <funcprototype>
41 <funcdef>char *<function>ne_strdup</function></funcdef>
42 <paramdef>const char *<parameter>s</parameter></paramdef>
43 </funcprototype>
44
45 <funcprototype>
46 <funcdef>char *<function>ne_strndup</function></funcdef>
47 <paramdef>const char *<parameter>s</parameter></paramdef>
48 <paramdef>size_t <parameter>size</parameter></paramdef>
49 </funcprototype>
50
51 <funcprototype>
52 <funcdef>void <function>ne_oom_callback</function></funcdef>
53 <paramdef>void (*<parameter>callback</parameter>)(void)</paramdef>
54 </funcprototype>
55
56 </funcsynopsis>
57
58 </refsynopsisdiv>
59
60 <refsect1>
61 <title>Description</title>
62
63 <para>The functions <function>ne_malloc</function>,
64 <function>ne_calloc</function>, <function>ne_realloc</function>,
65 <function>ne_strdup</function> and <function>ne_strdnup</function>
66 provide wrappers for the equivalent functions in the standard C
67 library. The wrappers provide the extra guarantee that if the C
68 library equivalent returns &null; when no memory is available, an
69 optional callback will be called, and the library will then call
70 <function>abort</function>().</para>
71
72 <para><function>ne_oom_callback</function> registers a callback
73 which will be invoked if an out of memory error is detected.</para>
74
75 </refsect1>
76
77 <refsect1>
78 <title>Notes</title>
79
80 <para>If the operating system uses optimistic memory
81 allocation, the C library memory allocation routines will not return
82 &null;, so it is not possible to gracefully handle memory allocation
83 failures.</para>
84
85 </refsect1>
86
87 </refentry>