'\" t .\" Title: ne_buffer_destroy .\" Author: .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 29 January 2024 .\" Manual: neon API reference .\" Source: neon 0.33.0 .\" Language: English .\" .TH "NE_BUFFER_DESTROY" "3" "29 January 2024" "neon 0.33.0" "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 .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 "AUTHOR" .PP \fBJoe Orton\fR .RS 4 Author. .RE .SH "COPYRIGHT" .br