GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
NE_BUFFER_DESTROY(3) neon API reference NE_BUFFER_DESTROY(3)

ne_buffer_destroy, ne_buffer_finish - destroy a buffer object

#include <ne_string.h>

void ne_buffer_destroy(ne_buffer *buf);

char *ne_buffer_finish(ne_buffer *buf);

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.

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

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

ne_buffer, ne_buffer_create, ne_buffer_zappend

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

12 January 2022 neon 0.32.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.