Files
2026-08-07 17:38:18 +09:00

13 lines
4.5 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_malloc</title><link rel="stylesheet" href="../manual.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="neon HTTP/WebDAV client library"><link rel="up" href="ref.html" title="neon API reference"><link rel="prev" href="refiaddr.html" title="ne_iaddr_make"><link rel="next" href="refsess.html" title="ne_session_create"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ne_malloc</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="refiaddr.html">Prev</a> </td><th width="60%" align="center">neon API reference</th><td width="20%" align="right"> <a accesskey="n" href="refsess.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="refalloc"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_malloc, ne_calloc, ne_realloc, ne_strdup, ne_strndup, ne_oom_callback — memory allocation wrappers</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_alloc.h&gt;</pre><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void *<b class="fsfunc">ne_malloc</b>(</code>size_t <var xmlns="" class="pdparam">size</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void *<b class="fsfunc">ne_calloc</b>(</code>size_t <var xmlns="" class="pdparam">size</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void *<b class="fsfunc">ne_realloc</b>(</code>void *<var xmlns="" class="pdparam">size</var>, size_t <var xmlns="" class="pdparam">len</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">char *<b class="fsfunc">ne_strdup</b>(</code>const char *<var xmlns="" class="pdparam">s</var>, size_t <var xmlns="" class="pdparam">size</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">char *<b class="fsfunc">ne_strndup</b>(</code>const char *<var xmlns="" class="pdparam">s</var>, size_t <var xmlns="" class="pdparam">size</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_oom_callback</b>(</code>void (*<var xmlns="" class="pdparam">callback</var>)(void)<code xmlns="">)</code>;</code></div></div></div><div class="refsect1" lang="en"><a name="id2934859"></a><h2>Description</h2><p>The functions <code class="function">ne_malloc</code>,
<code class="function">ne_calloc</code>, <code class="function">ne_realloc</code>,
<code class="function">ne_strdup</code> and <code class="function">ne_strdnup</code>
provide wrappers for the equivalent functions in the standard C
library. The wrappers provide the extra guarantee that if the C
library equivalent returns <code class="literal">NULL</code> when no memory is available, an
optional callback will be called, and the library will then call
<code class="function">abort</code>().</p><p><code class="function">ne_oom_callback</code> registers a callback
which will be invoked if an out of memory error is detected.</p></div><div class="refsect1" lang="en"><a name="id2934923"></a><h2>Notes</h2><p>If the operating system uses optimistic memory
allocation, the C library memory allocation routines will not return
<code class="literal">NULL</code>, so it is not possible to gracefully handle memory allocation
failures.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="refiaddr.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="refsess.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_iaddr_make </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ne_session_create</td></tr></table></div></body></html>