"Fossies" - the Fresh Open Source Software Archive

Member "neon-0.31.2/doc/man/ne_buffer_destroy.3" (20 Jun 2020, 2537 Bytes) of package /linux/www/neon-0.31.2.tar.gz:


Caution: As a special service "Fossies" has tried to format the requested manual source page into HTML format but links to other man pages may be missing or even erroneous. Alternatively you can here view or download the uninterpreted manual source code. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the latest Fossies "Diffs" side-by-side code changes report for "ne_buffer_destroy.3": 0.31.1_vs_0.31.2.

NE_BUFFER_DESTROY

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLES
SEE ALSO
AUTHOR
COPYRIGHT

NAME

ne_buffer_destroy, ne_buffer_finish − destroy a buffer object

SYNOPSIS

#include <ne_string.h>

void ne_buffer_destroy(ne_buffer *buf);

char *ne_buffer_finish(ne_buffer *buf);

DESCRIPTION

ne_buffer_destroy frees all memory associated with the buffer. ne_buffer_finish frees the buffer structure, but not the actual string stored in the buffer, which is returned and must be free()d by the caller.

Any use of the buffer object after calling either of these functions gives undefined behaviour.

RETURN VALUE

ne_buffer_finish returns the malloc−allocated string stored in the buffer.

EXAMPLES

An example use of ne_buffer_finish; the duplicate function returns a string made up of n copies of str:

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);
}

SEE ALSO

ne_buffer, ne_buffer_create, ne_buffer_zappend

AUTHOR

Joe Orton <neon@lists.manyfish.co.uk>

Author.

COPYRIGHT