logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ne_buffer_destroy, ne_buffer_finish - destroy a buffer object

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.

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

Name

       ne_buffer_destroy, ne_buffer_finish - destroy a buffer object

Return Value

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

See Also

       ne_buffer, ne_buffer_create, ne_buffer_zappend

Synopsis

#include<ne_string.h>voidne_buffer_destroy(ne_buffer*buf);char*ne_buffer_finish(ne_buffer*buf);

See Also