File: alloc.xml

package info (click to toggle)
neon27 0.36.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 2,836 kB
  • sloc: ansic: 27,754; xml: 4,634; makefile: 629; sh: 328
file content (87 lines) | stat: -rw-r--r-- 2,760 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    <refentry id="refalloc">

      <refmeta>
	<refentrytitle>ne_malloc</refentrytitle>
	<manvolnum>3</manvolnum>
      </refmeta>

      <refnamediv>
	<refname id="ne_malloc">ne_malloc</refname>
	<refname id="ne_calloc">ne_calloc</refname>
	<refname id="ne_realloc">ne_realloc</refname>
	<refname id="ne_strdup">ne_strdup</refname>
	<refname id="ne_strndup">ne_strndup</refname>
        <refname id="ne_oom_callback">ne_oom_callback</refname>
	<refpurpose>memory allocation wrappers</refpurpose>
      </refnamediv>
      
      <refsynopsisdiv>
	
	<funcsynopsis>

	  <funcsynopsisinfo>#include &lt;ne_alloc.h&gt;</funcsynopsisinfo>

	  <funcprototype>
	    <funcdef>void *<function>ne_malloc</function></funcdef>
	    <paramdef>size_t <parameter>size</parameter></paramdef>
	  </funcprototype>

	  <funcprototype>
	    <funcdef>void *<function>ne_calloc</function></funcdef>
	    <paramdef>size_t <parameter>size</parameter></paramdef>
	  </funcprototype>

	  <funcprototype>
	    <funcdef>void *<function>ne_realloc</function></funcdef>
	    <paramdef>void *<parameter>size</parameter></paramdef>
	    <paramdef>size_t <parameter>len</parameter></paramdef>
	  </funcprototype>

	  <funcprototype>
	    <funcdef>char *<function>ne_strdup</function></funcdef>
	    <paramdef>const char *<parameter>s</parameter></paramdef>
	  </funcprototype>

	  <funcprototype>
	    <funcdef>char *<function>ne_strndup</function></funcdef>
	    <paramdef>const char *<parameter>s</parameter></paramdef>
	    <paramdef>size_t <parameter>size</parameter></paramdef>
	  </funcprototype>

	  <funcprototype>
	    <funcdef>void <function>ne_oom_callback</function></funcdef>
	    <paramdef>void (*<parameter>callback</parameter>)(void)</paramdef>
	  </funcprototype>

	</funcsynopsis>
	
      </refsynopsisdiv>

      <refsect1>
	<title>Description</title>

	<para>The functions <function>ne_malloc</function>,
<function>ne_calloc</function>, <function>ne_realloc</function>,
<function>ne_strdup</function> and <function>ne_strdnup</function>
provide wrappers for the equivalent functions in the standard C
library.  The wrappers provide the extra guarantee that if the C
library equivalent returns &null; when no memory is available, an
optional callback will be called, and the library will then call
<function>abort</function>().</para>

	<para><function>ne_oom_callback</function> registers a callback
which will be invoked if an out of memory error is detected.</para>

      </refsect1>

      <refsect1>
	<title>Notes</title>

	<para>If the operating system uses optimistic memory
allocation, the C library memory allocation routines will not return
&null;, so it is not possible to gracefully handle memory allocation
failures.</para>

      </refsect1>

    </refentry>