12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- '\" t
- .\" Title: ne_buffer_destroy
- .\" Author:
- .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
- .\" Date: 15 April 2025
- .\" Manual: neon API reference
- .\" Source: neon 0.34.2
- .\" Language: English
- .\"
- .TH "NE_BUFFER_DESTROY" "3" "15 April 2025" "neon 0.34.2" "neon API reference"
- .\" -----------------------------------------------------------------
- .\" * Define some portability stuff
- .\" -----------------------------------------------------------------
- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- .\" http://bugs.debian.org/507673
- .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- .ie \n(.g .ds Aq \(aq
- .el .ds Aq '
- .\" -----------------------------------------------------------------
- .\" * set default formatting
- .\" -----------------------------------------------------------------
- .\" disable hyphenation
- .nh
- .\" disable justification (adjust text to left margin only)
- .ad l
- .\" -----------------------------------------------------------------
- .\" * MAIN CONTENT STARTS HERE *
- .\" -----------------------------------------------------------------
- .SH "NAME"
- ne_buffer_destroy, ne_buffer_finish \- destroy a buffer object
- .SH "SYNOPSIS"
- .sp
- .ft B
- .nf
- #include <ne_string\&.h>
- .fi
- .ft
- .HP \w'void\ ne_buffer_destroy('u
- .BI "void ne_buffer_destroy(ne_buffer\ *" "buf" ");"
- .HP \w'char\ *ne_buffer_finish('u
- .BI "char *ne_buffer_finish(ne_buffer\ *" "buf" ");"
- .SH "DESCRIPTION"
- .PP
- \fBne_buffer_destroy\fR
- frees all memory associated with the buffer\&.
- \fBne_buffer_finish\fR
- frees the buffer structure, but not the actual string stored in the buffer, which is returned and must be
- \fBfree\fR()d by the caller\&.
- .PP
- Any use of the buffer object after calling either of these functions gives undefined behaviour\&.
- .SH "RETURN VALUE"
- .PP
- \fBne_buffer_finish\fR
- returns the
- \fBmalloc\fR\-allocated string stored in the buffer\&.
- .SH "EXAMPLES"
- .PP
- An example use of
- \fBne_buffer_finish\fR; the
- \fBduplicate\fR
- function returns a string made up of
- \fIn\fR
- copies of
- \fIstr\fR:
- .sp
- .if n \{\
- .RS 4
- .\}
- .nf
- 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);
- }
- .fi
- .if n \{\
- .RE
- .\}
- .SH "SEE ALSO"
- .PP
- ne_buffer,
- ne_buffer_create,
- ne_buffer_zappend
- .SH "COPYRIGHT"
- .br
- Copyright \(co 2001-2024 Joe Orton
- .br
|