aboutsummaryrefslogtreecommitdiffstats
path: root/epan/emem.h
AgeCommit message (Collapse)AuthorFilesLines
2009-04-14ep_strbuf: fix some bugs and additional changeswmeier1-14/+22
-Bugs * str->len not set correctly in some cases; * trailing '\0' not always accounted for; * (issues relating to determining when & how much to expand string buffer). -Other * Change append, append_c, truncate to return pointer to ep_strbuf (similar to the corresponding GString functions); * Rename certain variables to clarify usage (as I understand the intended usage); * ep_strbuf_grow: use current allocated length and not current string length as the starting point; * Optimizations; * Add some additional comments to emem.h ep_strbuf section * Use consistent indentation throughout emem.c; git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28044 f5534014-38df-0310-8fa8-9805f1628bb7
2009-03-28Replace a lot of pointer tracking and some GStrings with emem_strbufs. Addgerald1-0/+17
ep_strbuf_printf and ep_strbuf_append_c. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27873 f5534014-38df-0310-8fa8-9805f1628bb7
2009-03-27Add initial support for string buffers - ep_allocated, growable stringsgerald1-0/+82
similar to GLib's GStrings. Use them to create the list of TCP flags. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27872 f5534014-38df-0310-8fa8-9805f1628bb7
2008-12-20Fix some typos and spelling (mostly in text strings)wmeier1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27068 f5534014-38df-0310-8fa8-9805f1628bb7
2008-08-05Add a debug helper for EP memory corruptionlego1-0/+15
if compiled in and the env var WIRESHARK_DEBUG_EP_CANARY is set: will check for canary integrity at every call to EP_CHECK_CANARY() if corruption is found it exits pronting the prior location and the location in which corruption was found. Hopefully it stops running while the corruptor is still in the stack. see EP_CHECK_CANARY() calls in packet.c as an example. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25927 f5534014-38df-0310-8fa8-9805f1628bb7
2008-06-25Fix some warnings - declare some arguments, variables, and structureguy1-1/+1
members to be const pointers when that's possible, and throw in some casts when the GLib API fails to have properly consted arguments. Use ep_strdup_printf() in some cases. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25596 f5534014-38df-0310-8fa8-9805f1628bb7
2007-12-04rework how emem trees indexed by strings so that traversing the tree sahlberg1-2/+4
will traverse the entries in the lexical order of the key. add a flag to lookup/insert for strings to specify whether a case insensitive key should be used instead of a (default) case sensitive key. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23736 f5534014-38df-0310-8fa8-9805f1628bb7
2007-12-04for nested trees, teach emem about which nodes contain a pointer to a sahlberg1-5/+8
subtree and which nodes that contain a pointer to user data teach emem to be able to traverse nested trees git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23733 f5534014-38df-0310-8fa8-9805f1628bb7
2007-12-03add tree traversal functionssahlberg1-0/+9
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23725 f5534014-38df-0310-8fa8-9805f1628bb7
2007-04-28In calls to the emem_tree routines, forcibly align items not known to beguy1-0/+4
aligned on 32-bit boundaries. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21611 f5534014-38df-0310-8fa8-9805f1628bb7
2007-04-23Add some GCC warnings to the standard set, and add some others to theguy1-3/+3
--enable-extra-gcc-checks set. If we turn on -pedantic, try turning on -Wno-long-long as well, so that it's not *so* pedantic that it rejects the 64-bit integral data types that we explicitly require. Constify a bunch of stuff, and make some other changes, to get rid of warnings. Clean up some indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21526 f5534014-38df-0310-8fa8-9805f1628bb7
2007-03-26From Doug Pratley:sfisher1-0/+5
The purpose of the patch is to provide a new output format (so it is independent of -V): single line record per-packet with the fields chosen by the user, with configuration options to control separator, quoting and whether a header line is printed. It also extends some existing options behaviour (-c and -a:filesize) so that they affect reading a file as well as writing one, so that only the first <n> packets or bytes are read). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21211 f5534014-38df-0310-8fa8-9805f1628bb7
2006-11-11fix so that tcp.pdu.time works again.sahlberg1-1/+1
it broken in one of the previous bugfixes to tcp add a function to print an emem tree to the console for easier emem tree debugging git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19877 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-17add trees with PErmanent allocation scope which will be useful for constructingsahlberg1-0/+13
associative arrays for globally unique and persistent mappings such as oid to name sid to name guid to name git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18937 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-14make creation of subtrees used for the _array tree type use the same ↵sahlberg1-31/+76
allocation scope as its parent and thus become allocation scope agnostic change all accessor functions to be defines to the emem_tree_ functions. now to create a tree with a different scope we only need to create a new ..._tree_create() function and set up the appropriate defines (it was a mistake to call the functions se_tree_create and se_tree_create_non_persistent, they should be the other way around i.e. se_tree_create_persistent and se_tree_create ) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18895 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-14rename some structures and defines from the se_tree to the emem_tree prefixsahlberg1-30/+32
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18894 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-12put a memory allocator function pointer inside the tree structure so that ↵sahlberg1-3/+5
all accessor functions become storage scope agnostic git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18888 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-28Ethereal->Wiresharketxrab1-7/+7
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18234 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-21name changesahlberg1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18197 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-02Not all compilers support unnamed struct/union fields withinguy1-1/+1
structs/unions (GCC supports it "for compatibility with other compilers"; presumably that's not for compatibility with the version of Sun C that rejected it - was that a PCCism?). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18072 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-18rename se_tree_lookup32_less_than_or_equal()sahlberg1-1/+1
to se_tree_lookup32_le() git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17664 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-18add new se_tree_lookup32_less_than_or_equal() callsahlberg1-0/+8
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17663 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-11give se_trees names so that it is easier to debug and to log how often ↵sahlberg1-2/+3
certain trees are accessed git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17587 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-07Rename set_string_hash... into se_tree_xxx_string as proposed by ronnie for ↵lego1-3/+3
consistency whith its real nature. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17496 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-07Add a hash table with string keys based on the red/black tree.lego1-0/+15
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17485 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-06add helper to build (red/black) trees from a key that is a vector of guin32 ↵sahlberg1-0/+67
arrays. test this functionality by calling these vector insert/lookup tree functions from the nfs dissector for when filehandles are used as a key. these vector functions could also be used to efficiently store conversations : se_tree_key_t[6] = { { addr_len/4, &src_addr }, { addr_len/4, &dst_addr }, { 1, &src_port32 }, { 1, &dst_port32 }, { 1, &protocol32 }, { 0, NULL } } (the nfs dissector needs a LOT of work. It is very painful to work with very large nfs traces with all the memory it wastes (and eats) as well as how slow all the tables make it) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17477 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-05initial implementation of binary tree support with se allocation scopesahlberg1-0/+39
this is to test out a basic implementation of binary trees and the api required for the helpers git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17467 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-14Have the emem.c memdup routines accept and return "void *", asguy1-2/+2
"memcpy()" does; that eliminates some compiler warnings ("void *" is the type usually used for "generic pointer"). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17297 f5534014-38df-0310-8fa8-9805f1628bb7
2005-10-10Add "ep_strdup_vprintf()" and "se_strdup_vprintf()", for completeness.guy1-2/+4
Make them not reuse a va_list; there's no guarantee that it can be used more than once and, in fact, on some platforms, you *can't* use it more than once. Based on a patch by Pekka Pietikainen. Clean up indentation a bit. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16174 f5534014-38df-0310-8fa8-9805f1628bb7
2005-10-01emem.[ch]:lego1-0/+30
Add a simple stack implememtation that uses ep_alloc Add ep_new() ep_new0() macros tpg.[ch]: use the stack in tpg helpers git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16061 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-15Tag ep_strdup_printf() and se_strdup_printf() as printf-like functions,guy1-2/+6
so we get compile-time checking of arguments when possible. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15813 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-16se_alloc not ep_alloc!lego1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15365 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-16more allocators se_alloc0() se_memdups() se_strdup() se_strndup() ↵lego1-2/+21
se_strdup_printf() git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15364 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-12Add beginning of seasonal allocation in addition to the existing ephemeral ↵sahlberg1-0/+26
ones. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15301 f5534014-38df-0310-8fa8-9805f1628bb7
2005-07-26new functions:lego1-0/+14
ep_tvb_memdup() ep_alloc0() ep_strsplit() add all of the ep_ allocators to libethereal.def git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15100 f5534014-38df-0310-8fa8-9805f1628bb7
2005-07-24add some utility functions that use ep_alloc instead of g_malloc.lego1-0/+14
ep_memdup ep_strdup ep_strndup ep_strdup_printf git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15018 f5534014-38df-0310-8fa8-9805f1628bb7
2005-07-22Set svn:keywords and svn:eol-stylejmayer1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14996 f5534014-38df-0310-8fa8-9805f1628bb7
2005-07-22EMEM : a simple and FAST api to allocate memory that will be automatically ↵sahlberg1-0/+49
freed() when the next packet is dissected. This offesr memory allocation with a packet scope making memory leaks less likely and memory management faster. Add initialization calls for both tethereal and ethereal. Convert the ip_to_str() function to use this and avoid doing the silly rotating buffers thing it previously did. We also need an equivalent set of functions for allocation with capture file scope (free when next capture is loaded) but i dont know where to put the free_all call. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14984 f5534014-38df-0310-8fa8-9805f1628bb7