1 <refentry id="refbuf"> 2 3 <refmeta> 4 <refentrytitle>ne_buffer</refentrytitle> 5 <manvolnum>3</manvolnum> 6 </refmeta> 7 8 <refnamediv> 9 <refname id="ne_buffer">ne_buffer</refname> 10 <refpurpose>string buffer handling</refpurpose> 11 </refnamediv> 12 13 <refsynopsisdiv> 14 15 <funcsynopsis><funcsynopsisinfo>#include <ne_string.h> 16 17typedef struct { 18 char *data; 19 size_t used; 20 size_t length; 21} <type>ne_buffer</type>;</funcsynopsisinfo></funcsynopsis> 22 23 </refsynopsisdiv> 24 25 <refsect1> 26 <title>Description</title> 27 28 <para>The <type>ne_buffer</type> type represents an expandable 29memory buffer for holding &nul;-terminated strings. The 30<structfield>data</structfield> field points to the beginnning of the 31string, the length of which is given by the 32<structfield>used</structfield> field. The current size of memory 33allocated is given by the <structfield>length</structfield> field. It 34is not recommended that the fields of a buffer are manipulated 35directly. The <structfield>data</structfield> pointer may change when 36the buffer is modified.</para> 37 38 <para>A buffer is created using <xref 39linkend="ne_buffer_create"/> or <xref 40linkend="ne_buffer_create_sized"/>, and destroyed using <xref 41linkend="ne_buffer_destroy"/> or <xref linkend="ne_buffer_finish"/>. 42The functions <xref linkend="ne_buffer_append"/>, <xref 43linkend="ne_buffer_zappend"/> and <xref linkend="ne_buffer_concat"/> are 44used to append data to a buffer.</para> 45 46 <para>If the string referenced by the 47<structfield>data</structfield> pointer is modified directly (rather 48than using one of the functions listed above), 49<function>ne_buffer_altered</function> must be called.</para> 50 51 </refsect1> 52 53 </refentry> 54