File: refbufdest.html

package info (click to toggle)
tla 1.3.5%2Bdfsg1-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 22,292 kB
  • ctags: 11,952
  • sloc: ansic: 149,771; sh: 16,009; xml: 2,689; lisp: 1,927; makefile: 1,064; cpp: 363; tcl: 230; awk: 48; sed: 25
file content (17 lines) | stat: -rw-r--r-- 3,864 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>ne_buffer_destroy</title><link rel="stylesheet" href="../manual.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.65.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="previous" 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" lang="en"><a name="refbufdest"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>ne_buffer_destroy, ne_buffer_finish &#8212; destroy a buffer object</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_string.h&gt;</pre><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_buffer_destroy</b>(</code>ne_buffer *<var xmlns="" class="pdparam">buf</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_buffer_finish</b>(</code>ne_buffer *<var xmlns="" class="pdparam">buf</var><code xmlns="">)</code>;</code></div></div></div><div class="refsect1" lang="en"><a name="id3024841"></a><h2>Description</h2><p><tt class="function">ne_buffer_destroy</tt> frees all memory
associated with the buffer.  <tt class="function">ne_buffer_finish</tt>
frees the buffer structure, but not the actual string stored in the
buffer, which is returned and must be <tt class="function">free</tt>()d by
the caller.</p><p>Any use of the buffer object after calling either of these
functions gives undefined behaviour.</p></div><div class="refsect1" lang="en"><a name="id3024874"></a><h2>Return value</h2><p><tt class="function">ne_buffer_finish</tt> returns the
<tt class="function">malloc</tt>-allocated string stored in the buffer.</p></div><div class="refsect1" lang="en"><a name="id3024896"></a><h2>Examples</h2><p>An example use of <tt class="function">ne_buffer_finish</tt>;
the <tt class="function">duplicate</tt> function returns a string made up of 
<tt class="parameter">n</tt> copies of <tt class="parameter">str</tt>:</p><pre class="programlisting">static char *duplicate(int n, const char *str)
{
  ne_buffer *buf = ne_buffer_create();
  while (n--) {
    ne_buffer_zappend(buf, str);
  }
  return ne_buffer_finish(buf);
}</pre></div><div class="refsect1" lang="en"><a name="id3024939"></a><h2>See also</h2><p><a href="refbuf.html#ne_buffer">ne_buffer</a>, <a href="refbufcr.html#ne_buffer_create">ne_buffer_create</a>,
<a 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>