diff options
author | Gerald Combs <gerald@wireshark.org> | 2009-03-27 23:05:37 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2009-03-27 23:05:37 +0000 |
commit | 446d43351ce4f4b03cc9b85831445d7e48e72dc6 (patch) | |
tree | 326ce04ad1aac3020ac517473660028fa8f60e6a /doc | |
parent | ab972611dacb37eb6bdd52ea1ece369070732279 (diff) |
Add initial support for string buffers - ep_allocated, growable strings
similar to GLib's GStrings. Use them to create the list of TCP flags.
svn path=/trunk/; revision=27872
Diffstat (limited to 'doc')
-rw-r--r-- | doc/README.developer | 11 | ||||
-rw-r--r-- | doc/README.malloc | 14 |
2 files changed, 22 insertions, 3 deletions
diff --git a/doc/README.developer b/doc/README.developer index be0279452e..5e0b28d94a 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -399,8 +399,15 @@ buffer overflows for large strings. When using a buffer to create a string, do not use a buffer stored on the stack. I.e. do not use a buffer declared as char buffer[1024]; -instead allocate a buffer dynamically using the emem routines (see -README.malloc) such as +instead allocate a buffer dynamically using the string-specific or plain emem +routines (see README.malloc) such as + + emem_strbuf_t *strbuf; + strbuf = ep_strbuf_new_label(""); + ep_strbuf_append_printf(strbuf, ... + +or + char *buffer=NULL; ... #define MAX_BUFFER 1024 diff --git a/doc/README.malloc b/doc/README.malloc index 7fbdf3ba5f..9224bb1595 100644 --- a/doc/README.malloc +++ b/doc/README.malloc @@ -76,4 +76,16 @@ ep_stack_peek() : returns the top element of the stack without popping it. ep_tvb_memdup(): create an ephemeral duplicate of part of the tvbuff. - +3.4 String buffers + +The ep_strbuf_... functions create and modify growable strings, similar to GLib's +GStrings. + +ep_strbuf_new(s) : Creates a new strbuf, initialized to s. +ep_strbuf_new_label(s) : Like ep_strbuf_new, but with a max length suitable for + protocol tree items. +ep_strbuf_sized_new() : Creates a new strbuf with explicit sizes. +ep_strbuf_append_vprintf() : Appends an argument list to a strbuf. +ep_strbuf_append_printf() : Appends to a strbuf in the style of printf. +ep_strbuf_append() : Appends a string to a strbuf. +ep_strbuf_truncate() : Shortens a strbuf. |