| 1 |
'\" t |
| 2 |
.\" Title: ne_buffer_destroy |
| 3 |
.\" Author: |
| 4 |
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/> |
| 5 |
.\" Date: 3 May 2011 |
| 6 |
.\" Manual: neon API reference |
| 7 |
.\" Source: neon 0.29.6 |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "NE_BUFFER_DESTROY" "3" "3 May 2011" "neon 0.29.6" "neon API reference" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
ne_buffer_destroy, ne_buffer_finish \- destroy a buffer object |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.sp |
| 34 |
.ft B |
| 35 |
.nf |
| 36 |
#include <ne_string\&.h> |
| 37 |
.fi |
| 38 |
.ft |
| 39 |
.HP \w'void\ ne_buffer_destroy('u |
| 40 |
.BI "void ne_buffer_destroy(ne_buffer\ *" "buf" ");" |
| 41 |
.HP \w'char\ *ne_buffer_finish('u |
| 42 |
.BI "char *ne_buffer_finish(ne_buffer\ *" "buf" ");" |
| 43 |
.SH "DESCRIPTION" |
| 44 |
.PP |
| 45 |
\fBne_buffer_destroy\fR |
| 46 |
frees all memory associated with the buffer\&. |
| 47 |
\fBne_buffer_finish\fR |
| 48 |
frees the buffer structure, but not the actual string stored in the buffer, which is returned and must be |
| 49 |
\fBfree\fR()d by the caller\&. |
| 50 |
.PP |
| 51 |
Any use of the buffer object after calling either of these functions gives undefined behaviour\&. |
| 52 |
.SH "RETURN VALUE" |
| 53 |
.PP |
| 54 |
\fBne_buffer_finish\fR |
| 55 |
returns the |
| 56 |
\fBmalloc\fR\-allocated string stored in the buffer\&. |
| 57 |
.SH "EXAMPLES" |
| 58 |
.PP |
| 59 |
An example use of |
| 60 |
\fBne_buffer_finish\fR; the |
| 61 |
\fBduplicate\fR |
| 62 |
function returns a string made up of |
| 63 |
\fIn\fR |
| 64 |
copies of |
| 65 |
\fIstr\fR: |
| 66 |
.sp |
| 67 |
.if n \{\ |
| 68 |
.RS 4 |
| 69 |
.\} |
| 70 |
.nf |
| 71 |
static char *duplicate(int n, const char *str) |
| 72 |
{ |
| 73 |
ne_buffer *buf = ne_buffer_create(); |
| 74 |
while (n\-\-) { |
| 75 |
ne_buffer_zappend(buf, str); |
| 76 |
} |
| 77 |
return ne_buffer_finish(buf); |
| 78 |
} |
| 79 |
.fi |
| 80 |
.if n \{\ |
| 81 |
.RE |
| 82 |
.\} |
| 83 |
.SH "SEE ALSO" |
| 84 |
.PP |
| 85 |
ne_buffer, |
| 86 |
ne_buffer_create, |
| 87 |
ne_buffer_zappend |
| 88 |
.SH "AUTHOR" |
| 89 |
.PP |
| 90 |
\fBJoe Orton\fR <\&[email protected]\&> |
| 91 |
.RS 4 |
| 92 |
Author. |
| 93 |
.RE |
| 94 |
.SH "COPYRIGHT" |
| 95 |
.br |