base
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
'\" t
|
||||
.\" Title: ne_malloc
|
||||
.\" Author:
|
||||
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
|
||||
.\" Date: 14 October 2010
|
||||
.\" Manual: neon API reference
|
||||
.\" Source: neon 0.29.5
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "NE_MALLOC" "3" "14 October 2010" "neon 0.29.5" "neon API reference"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
.ad l
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * MAIN CONTENT STARTS HERE *
|
||||
.\" -----------------------------------------------------------------
|
||||
.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 <ne_alloc\&.h>
|
||||
.fi
|
||||
.ft
|
||||
.HP \w'void\ *ne_malloc('u
|
||||
.BI "void *ne_malloc(size_t\ " "size" ");"
|
||||
.HP \w'void\ *ne_calloc('u
|
||||
.BI "void *ne_calloc(size_t\ " "size" ");"
|
||||
.HP \w'void\ *ne_realloc('u
|
||||
.BI "void *ne_realloc(void\ *" "size" ", size_t\ " "len" ");"
|
||||
.HP \w'char\ *ne_strdup('u
|
||||
.BI "char *ne_strdup(const\ char\ *" "s" ");"
|
||||
.HP \w'char\ *ne_strndup('u
|
||||
.BI "char *ne_strndup(const\ char\ *" "s" ", size_t\ " "size" ");"
|
||||
.HP \w'void\ ne_oom_callback('u
|
||||
.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@lists.manyfish.co.uk\&>
|
||||
.RS 4
|
||||
Author.
|
||||
.RE
|
||||
.SH "COPYRIGHT"
|
||||
.br
|
||||
Reference in New Issue
Block a user