1NE_BUFFER_DESTROY(3) neon API reference NE_BUFFER_DESTROY(3)
2
3
4
6 ne_buffer_destroy, ne_buffer_finish - destroy a buffer object
7
9 #include <ne_string.h>
10
11
12 void ne_buffer_destroy (ne_buffer *buf);
13
14 char *ne_buffer_finish (ne_buffer *buf);
15
16
18 ne_buffer_destroy frees all memory associated with the buffer. ne_buf‐
19 fer_finish frees the buffer structure, but not the actual string stored
20 in the buffer, which is returned and must be free()d by the caller.
21
22
23 Any use of the buffer object after calling either of these functions
24 gives undefined behaviour.
25
26
28 ne_buffer_finish returns the malloc-allocated string stored in the buf‐
29 fer.
30
31
33 An example use of ne_buffer_finish; the duplicate function returns a
34 string made up of n copies of str:
35
36 static char *duplicate(int n, const char *str)
37 {
38 ne_buffer *buf = ne_buffer_create();
39 while (n--) {
40 ne_buffer_zappend(buf, str);
41 }
42 return ne_buffer_finish(buf);
43 }
44
45
47 ne_buffer(3), ne_buffer_create(3), ne_buffer_zappend(3)
48
49
51 Joe Orton <neon@webdav.org>.
52
53
54
55neon 0.25.5 20 January 2006 NE_BUFFER_DESTROY(3)