Commit Graph

58 Commits

Author SHA1 Message Date
Jaap Keuter c80ed42fc6 Vastly improve the debug presentation( of trees)+.
svn path=/trunk/; revision=45340
2012-10-06 14:35:59 +00:00
Michael Mann 493516fd6c Convert GString to emem_strbuf_t in packet-gadu-gadu.c
Required an additional function, ep_strbuf_append_unichar, in emem module

svn path=/trunk/; revision=44564
2012-08-18 19:20:31 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Jeff Morriss 06bb167824 The rest of the fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7221
(emem alignment problems on SPARC) :

Have emem use 8-byte alignment when we need it.

Since I can't seem to write code that which reliably (across GCC versions and
optimization levels) determines if 8-byte alignment is needed for doubles,
"when" is defined as "if we're compiling for a CPU other than i386."

Windows doesn't need a check because it's either i386 or 64-bit (x86_64 or
maybe ia64--both of which get 8-byte alignment from G_MEM_ALIGN).

(And, yes, all of this is ignoring the 16-byte alignment requirements of long
doubles.)

svn path=/trunk/; revision=42431
2012-05-04 21:56:32 +00:00
Anders Broman 62866c78a0 Get rid of Warnings.
svn path=/trunk/; revision=39957
2011-11-20 12:43:04 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Jakub Zawadzki 99351cb0e3 Initial commit of slab allocator (sl_* API)
svn path=/trunk/; revision=37027
2011-05-09 08:55:35 +00:00
Jeff Morriss ecf8cbed34 As suggested by Jakub Zawadzki:
Rename g_gnuc_malloc.h to g_gnuc.h (since it contains non-malloc related
GNUC stuff).

Use G_GNUC_WARN_UNUSED_RESULT from glib instead of using warn_unused_result
directly.

svn path=/trunk/; revision=36825
2011-04-22 17:57:10 +00:00
Jeff Morriss 3161977bf8 Introduce ep_strconcat (copied from the glib version)
svn path=/trunk/; revision=36344
2011-03-26 02:39:04 +00:00
Anders Broman a009cc0605 Doxygen changes.
svn path=/trunk/; revision=33990
2010-08-29 10:47:38 +00:00
Anders Broman 1c2b3b0eb9 Fix a number of doxygen directives.
svn path=/trunk/; revision=33930
2010-08-26 15:24:49 +00:00
Jeff Morriss c1e3350a32 Fix a few comment typos
svn path=/trunk/; revision=32492
2010-04-16 15:05:42 +00:00
Stig Bjørlykke f57d6e2095 From Alex Lindberg via bug 4463:
Added se_tree_lookup32_array_le to emem.[ch].  This function is similar to
se_tree_lookup32_le already defined.

Updated README.binarytrees to reflect this added function and corrected minor
spelling issues.

svn path=/trunk/; revision=31812
2010-02-07 11:01:13 +00:00
Stig Bjørlykke 9092486f58 Changed from using own defined GNUC_FORMAT_CHECK to G_GNUC_PRINTF
defined in GLib.  Removed epan/gnuc_format_check.h.

svn path=/trunk/; revision=31657
2010-01-25 13:20:53 +00:00
Stig Bjørlykke 2b5f360066 From Didier Gautheron via bug 4419:
Use G_GNUC_MALLOC in emem.h declarations.

From me:
Check for valid G_GNUC_MALLOC from g_gnuc_malloc.h.

svn path=/trunk/; revision=31656
2010-01-25 12:50:42 +00:00
Jeff Morriss 78318b32ee Add emem_init() which initializes both the ep_ and se_ allocators; have all
callers use that instead of initializing each allocator individually.

svn path=/trunk/; revision=30646
2009-10-20 17:43:05 +00:00
Kovarththanan Rajaratnam 88186e9b5a Annotate with GNUC_FORMAT_CHECK()
svn path=/trunk/; revision=30489
2009-10-11 06:22:55 +00:00
Kovarththanan Rajaratnam 1a61b42e8a Add ep_verify_pointer()/se_verify_pointer() which checks whether the given pointer belongs in the seasonal/ephemeral pool.
svn path=/trunk/; revision=30011
2009-09-20 12:02:40 +00:00
Kovarththanan Rajaratnam 42b01b61ab Make se_trees static in emem.c
svn path=/trunk/; revision=30008
2009-09-20 09:28:55 +00:00
Kovarththanan Rajaratnam e0e33ca74b We now expose the following environment variables:
* WIRESHARK_DEBUG_EP_NO_CHUNKS
 * WIRESHARK_DEBUG_SE_NO_CHUNKS
 * WIRESHARK_DEBUG_EP_NO_CANARY
 * WIRESHARK_DEBUG_SE_NO_CANARY

This allows us to enable/disable memory chunks and canaries at runtime _without_ needing to recompile.

svn path=/trunk/; revision=29375
2009-08-11 09:24:56 +00:00
Bill Meier fdda6e8778 ep_strbuf: fix some bugs and additional changes
-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;

svn path=/trunk/; revision=28044
2009-04-14 14:08:19 +00:00
Gerald Combs 21e87a963f Replace a lot of pointer tracking and some GStrings with emem_strbufs. Add
ep_strbuf_printf and ep_strbuf_append_c.

svn path=/trunk/; revision=27873
2009-03-28 00:27:03 +00:00
Gerald Combs 446d43351c 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
2009-03-27 23:05:37 +00:00
Bill Meier ea2d615dd7 Fix some typos and spelling (mostly in text strings)
svn path=/trunk/; revision=27068
2008-12-20 01:01:28 +00:00
Luis Ontanon 230d917776 Add a debug helper for EP memory corruption
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.




svn path=/trunk/; revision=25927
2008-08-05 02:23:35 +00:00
Guy Harris 9e6329860a Fix some warnings - declare some arguments, variables, and structure
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.

svn path=/trunk/; revision=25596
2008-06-25 03:05:19 +00:00
Ronnie Sahlberg b153578afa rework how emem trees indexed by strings so that traversing the tree
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.


svn path=/trunk/; revision=23736
2007-12-04 03:26:50 +00:00
Ronnie Sahlberg c20bb13d67 for nested trees, teach emem about which nodes contain a pointer to a
subtree and which nodes that contain a pointer to user data

teach emem to be able to traverse nested trees


svn path=/trunk/; revision=23733
2007-12-04 01:44:05 +00:00
Ronnie Sahlberg 60c561e2bd add tree traversal functions
svn path=/trunk/; revision=23725
2007-12-03 22:47:23 +00:00
Guy Harris b98d651b21 In calls to the emem_tree routines, forcibly align items not known to be
aligned on 32-bit boundaries.

svn path=/trunk/; revision=21611
2007-04-28 21:09:20 +00:00
Guy Harris 1bc049906a Add some GCC warnings to the standard set, and add some others to the
--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.

svn path=/trunk/; revision=21526
2007-04-23 10:59:26 +00:00
Stephen Fisher 509883e3e9 From Doug Pratley:
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).


svn path=/trunk/; revision=21211
2007-03-26 20:17:05 +00:00
Ronnie Sahlberg 14810dd30c fix so that tcp.pdu.time works again.
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


svn path=/trunk/; revision=19877
2006-11-11 22:39:25 +00:00
Ronnie Sahlberg 2fdf0e4b4b add trees with PErmanent allocation scope which will be useful for constructing
associative arrays for globally unique and persistent mappings such as
oid to name
sid to name
guid to name


svn path=/trunk/; revision=18937
2006-08-17 08:17:48 +00:00
Ronnie Sahlberg 2657b9b701 make creation of subtrees used for the _array tree type use the same 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 )



svn path=/trunk/; revision=18895
2006-08-14 09:36:15 +00:00
Ronnie Sahlberg 8ce8e719e0 rename some structures and defines from the se_tree to the emem_tree prefix
svn path=/trunk/; revision=18894
2006-08-14 08:29:29 +00:00
Ronnie Sahlberg 8529abb69b put a memory allocator function pointer inside the tree structure so that all accessor functions become storage scope agnostic
svn path=/trunk/; revision=18888
2006-08-12 23:27:22 +00:00
Anders Broman 996d4db495 Ethereal->Wireshark
svn path=/trunk/; revision=18234
2006-05-28 19:49:07 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Guy Harris 25bead5edf Not all compilers support unnamed struct/union fields within
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?).

svn path=/trunk/; revision=18072
2006-05-02 18:02:08 +00:00
Ronnie Sahlberg 93471988aa rename se_tree_lookup32_less_than_or_equal()
to se_tree_lookup32_le()


svn path=/trunk/; revision=17664
2006-03-18 09:01:42 +00:00
Ronnie Sahlberg c4c2ce2606 add new se_tree_lookup32_less_than_or_equal() call
svn path=/trunk/; revision=17663
2006-03-18 06:15:39 +00:00
Ronnie Sahlberg 27de4cfd39 give se_trees names so that it is easier to debug and to log how often certain trees are accessed
svn path=/trunk/; revision=17587
2006-03-11 13:02:41 +00:00
Luis Ontanon 65f5262bb6 Rename set_string_hash... into se_tree_xxx_string as proposed by ronnie for consistency whith its real nature.
svn path=/trunk/; revision=17496
2006-03-07 14:10:30 +00:00
Luis Ontanon 8dbad83e5c Add a hash table with string keys based on the red/black tree.
svn path=/trunk/; revision=17485
2006-03-07 01:15:29 +00:00
Ronnie Sahlberg 745994c364 add helper to build (red/black) trees from a key that is a vector of guin32 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)



svn path=/trunk/; revision=17477
2006-03-06 10:25:19 +00:00
Ronnie Sahlberg 0881211a12 initial implementation of binary tree support with se allocation scope
this is to test out a basic implementation of binary trees and the api required for the helpers


svn path=/trunk/; revision=17467
2006-03-05 04:01:34 +00:00
Guy Harris 58ed459c33 Have the emem.c memdup routines accept and return "void *", as
"memcpy()" does; that eliminates some compiler warnings ("void *" is the
type usually used for "generic pointer").

svn path=/trunk/; revision=17297
2006-02-14 08:34:20 +00:00
Guy Harris 67b91b5163 Add "ep_strdup_vprintf()" and "se_strdup_vprintf()", for completeness.
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.

svn path=/trunk/; revision=16174
2005-10-10 08:24:56 +00:00
Luis Ontanon 9860d26c68 emem.[ch]:
Add a simple stack implememtation that uses ep_alloc
Add ep_new() ep_new0() macros

tpg.[ch]:
use the stack in tpg helpers


svn path=/trunk/; revision=16061
2005-10-01 10:36:57 +00:00