.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "NE_MALLOC" 3 "20 January 2006" "neon 0.25.5" "neon API reference"
.SH NAME
ne_malloc, ne_calloc, ne_realloc, ne_strdup, ne_strndup, ne_oom_callback \- memory allocation wrappers
.SH "SYNOPSIS"
.ad l
.hy 0

#include <ne_alloc\&.h>
.sp
.HP 17
void\ *\fBne_malloc\fR\ (size_t\ \fIsize\fR);
.HP 17
void\ *\fBne_calloc\fR\ (size_t\ \fIsize\fR);
.HP 18
void\ *\fBne_realloc\fR\ (void\ *\fIsize\fR, size_t\ \fIlen\fR);
.HP 17
char\ *\fBne_strdup\fR\ (const\ char\ *\fIs\fR, size_t\ \fIsize\fR);
.HP 18
char\ *\fBne_strndup\fR\ (const\ char\ *\fIs\fR, size_t\ \fIsize\fR);
.HP 22
void\ \fBne_oom_callback\fR\ (void\ (*\fIcallback\fR)(void));
.ad
.hy

.SH "DESCRIPTION"

.PP
The functions \fBne_malloc\fR, \fBne_calloc\fR, \fBne_realloc\fR, \fBne_strdup\fR and \fBne_strdnup\fR 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 \fBabort\fR()\&.

.PP
\fBne_oom_callback\fR registers a callback which will be invoked if an out of memory error is detected\&.

.SH "NOTES"

.PP
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\&.

.SH AUTHOR
Joe Orton <neon@webdav\&.org>.
