1NE_BUFFER_DESTROY(3)          neon API reference          NE_BUFFER_DESTROY(3)
2
3
4

NAME

6       ne_buffer_destroy, ne_buffer_finish - destroy a buffer object
7

SYNOPSIS

9       #include <ne_string.h>
10
11       void ne_buffer_destroy(ne_buffer *buf);
12
13       char *ne_buffer_finish(ne_buffer *buf);
14

DESCRIPTION

16       ne_buffer_destroy frees all memory associated with the buffer.
17       ne_buffer_finish frees the buffer structure, but not the actual string
18       stored in the buffer, which is returned and must be free()d by the
19       caller.
20
21       Any use of the buffer object after calling either of these functions
22       gives undefined behaviour.
23

RETURN VALUE

25       ne_buffer_finish returns the malloc-allocated string stored in the
26       buffer.
27

EXAMPLES

29       An example use of ne_buffer_finish; the duplicate function returns a
30       string made up of n copies of str:
31
32           static char *duplicate(int n, const char *str)
33           {
34             ne_buffer *buf = ne_buffer_create();
35             while (n--) {
36               ne_buffer_zappend(buf, str);
37             }
38             return ne_buffer_finish(buf);
39           }
40

SEE ALSO

42       ne_buffer, ne_buffer_create, ne_buffer_zappend
43

AUTHOR

45       Joe Orton <neon@lists.manyfish.co.uk>
46           Author.
47
49neon 0.30.0                      31 July 2013             NE_BUFFER_DESTROY(3)
Impressum