.\" Title: ne_malloc .\" Author: .\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: 14 July 2007 .\" Manual: neon API reference .\" Source: neon 0.26.4 .\" .TH "NE_MALLOC" "3" "14 July 2007" "neon 0.26.4" "neon API reference" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" ne_malloc, ne_calloc, ne_realloc, ne_strdup, ne_strndup, ne_oom_callback \- memory allocation wrappers .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP 16 .BI "void *ne_malloc(size_t\ " "size" ");" .HP 16 .BI "void *ne_calloc(size_t\ " "size" ");" .HP 17 .BI "void *ne_realloc(void\ *" "size" ", size_t\ " "len" ");" .HP 16 .BI "char *ne_strdup(const\ char\ *" "s" ");" .HP 17 .BI "char *ne_strndup(const\ char\ *" "s" ", size_t\ " "size" ");" .HP 21 .BI "void ne_oom_callback(void\ (*" "callback" ")(void));" .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" .PP \fBJoe Orton\fR <\&neon@webdav.org\&> .sp -1n .IP "" 4 Author. .SH "COPYRIGHT"