1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_buffer_destroy</title><link rel="stylesheet" type="text/css" href="../manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="neon HTTP/WebDAV client library"><link rel="up" href="ref.html" title="neon API reference"><link rel="prev" href="refbufcr.html" title="ne_buffer_create"><link rel="next" href="referr.html" title="ne_get_error"></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_buffer_destroy</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="refbufcr.html">Prev</a>��</td><th width="60%" align="center">neon API reference</th><td width="20%" align="right">��<a accesskey="n" href="referr.html">Next</a></td></tr></table><hr></div><div class="refentry" title="ne_buffer_destroy"><a name="refbufdest"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_buffer_destroy, ne_buffer_finish ��� destroy a buffer object</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <ne_string.h></pre><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">ne_buffer_destroy</b>(</code></td><td>ne_buffer *<var class="pdparam">buf</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">��</div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">char *<b class="fsfunc">ne_buffer_finish</b>(</code></td><td>ne_buffer *<var class="pdparam">buf</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">��</div></div></div><div class="refsect1" title="Description"><a name="id450787"></a><h2>Description</h2><p><code class="function">ne_buffer_destroy</code> frees all memory 2associated with the buffer. <code class="function">ne_buffer_finish</code> 3frees the buffer structure, but not the actual string stored in the 4buffer, which is returned and must be <code class="function">free</code>()d by 5the caller.</p><p>Any use of the buffer object after calling either of these 6functions gives undefined behaviour.</p></div><div class="refsect1" title="Return value"><a name="id450816"></a><h2>Return value</h2><p><code class="function">ne_buffer_finish</code> returns the 7<code class="function">malloc</code>-allocated string stored in the buffer.</p></div><div class="refsect1" title="Examples"><a name="id450835"></a><h2>Examples</h2><p>An example use of <code class="function">ne_buffer_finish</code>; 8the <code class="function">duplicate</code> function returns a string made up of 9<code class="parameter">n</code> copies of <code class="parameter">str</code>:</p><pre class="programlisting">static char *duplicate(int n, const char *str) 10{ 11 ne_buffer *buf = ne_buffer_create(); 12 while (n--) { 13 ne_buffer_zappend(buf, str); 14 } 15 return ne_buffer_finish(buf); 16}</pre></div><div class="refsect1" title="See also"><a name="id450872"></a><h2>See also</h2><p><a class="xref" href="refbuf.html#ne_buffer">ne_buffer</a>, <a class="xref" href="refbufcr.html#ne_buffer_create">ne_buffer_create</a>, 17<a class="xref" href="refbufapp.html#ne_buffer_zappend">ne_buffer_zappend</a></p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="refbufcr.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="referr.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_buffer_create��</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">��ne_get_error</td></tr></table></div></body></html> 18