Evan Huus
dc0b7253e4
Don't assert that the key to a wmem tree operation is short. If XMPP wants to
...
use a 1500-byte string as a key, so be it. It will be slow, but at least it will
work.
Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9078
svn path=/trunk/; revision=52261
2013-09-28 23:45:18 +00:00
Evan Huus
3c1e67c22d
Send all alloc and free calls within wmem through wmem_alloc and wmem_free with
...
a NULL allocator. This gives us a single, central place to handle out-of-memory
errors (by, for example, throwing an exception) for basically all of epan.
The only remaining glib memory that is directly allocated is for the hash tables
used by the simple and strict allocators.
svn path=/trunk/; revision=51627
2013-09-01 13:37:38 +00:00
Guy Harris
e8f42c6b48
Include config.h first; it defines _FILE_OFFSET_BITS, and if some system
...
header later causes it to be redefined - as happens on my Solaris 11
virtual machine - we get a redefinition warning, which gets treated as
an error.
svn path=/trunk/; revision=51344
2013-08-14 00:31:14 +00:00
Evan Huus
8fafa9b758
Add wmem_tree_is_empty(). Also permit lookups on a NULL tree for compatibility
...
with emem.
svn path=/trunk/; revision=51045
2013-07-31 01:48:47 +00:00
Chris Maynard
1c19a0d61e
Fix warnings: format '%blah' expects argument of type 'foo', but argument 'i' has type 'bar' [-Wformat].
...
svn path=/trunk/; revision=50639
2013-07-15 21:22:34 +00:00
Evan Huus
ffe6d9c4d6
Misc little cleanups to wmem tree (comments, whitespace, assertions)
...
svn path=/trunk/; revision=50182
2013-06-27 03:01:53 +00:00
Evan Huus
bfa8d9af75
Make assertions in tree lookup more useful and fix formatting.
...
Should help debugging https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8833
svn path=/trunk/; revision=50115
2013-06-22 21:00:36 +00:00
Evan Huus
da6d99e2c9
Refactor insert32 to use lookup_or_insert32 with the right flags.
...
svn path=/trunk/; revision=50013
2013-06-18 19:55:29 +00:00
Evan Huus
4313d778f0
Refactor lookup_or_insert32 to remove a bunch of continue and break statements
...
as well as a confusing while(TRUE).
svn path=/trunk/; revision=50012
2013-06-18 19:43:18 +00:00
Evan Huus
8610601f60
Simplify node structure. Use a boolean for whether or not it's a subtree, and an
...
enum for the color (red/black). Don't use bitfields since they don't save us
much (if anything) in terms of space and don't nest the fields in their own
anonymous struct.
svn path=/trunk/; revision=50011
2013-06-18 19:32:40 +00:00
Evan Huus
02752f3161
Factor function for node creation out and use it in several places.
...
svn path=/trunk/; revision=50010
2013-06-18 19:19:21 +00:00
Evan Huus
115eb9c727
Factor common code for red-black tree array lookups into a helper function and
...
use it for both direct lookups and less-than-or-equal-to lookups.
svn path=/trunk/; revision=50008
2013-06-18 18:57:28 +00:00
Evan Huus
7fd970ac45
Remove wmem_tree_create_subtree, it does nothing we can't do with
...
wmem_tree_new.
svn path=/trunk/; revision=50007
2013-06-18 17:48:04 +00:00
Evan Huus
d0c1d89cd6
Factor string-packing code into a common function to use in both insert_string
...
and lookup_string.
svn path=/trunk/; revision=50006
2013-06-18 17:39:15 +00:00
Evan Huus
7c99d55773
Re-port a bunch of the red-black tree code from wmem with fewer modifications,
...
and enable the tests.
Lesson: make it work, *then* refactor it into sanity.
svn path=/trunk/; revision=50002
2013-06-18 05:31:12 +00:00
Evan Huus
5c027c2590
Extract some common code for array lookups, and replace some DISSECTOR
...
assertions with regular glib assertions - there's no guarantee that wmem code
will always be run from within a dissector.
svn path=/trunk/; revision=49993
2013-06-17 22:51:50 +00:00
Evan Huus
fd22c548f5
Much smarter handling of autoreset trees.
...
svn path=/trunk/; revision=49970
2013-06-17 00:08:44 +00:00
Evan Huus
55264582be
More callback tweaks, to permit unregistering a callback from the same place
...
it was originally registered.
svn path=/trunk/; revision=49969
2013-06-16 22:37:55 +00:00
Evan Huus
88c5b2e892
Rework the user callback code a bit to make it saner to use with the auto-reset
...
trees.
svn path=/trunk/; revision=49966
2013-06-16 22:07:24 +00:00
Evan Huus
d0fb6aca01
Simplify the tree code slightly - just don't call the transform function
...
if it's NULL, meaning we don't need to define an identity callback.
svn path=/trunk/; revision=49962
2013-06-16 15:17:53 +00:00
Evan Huus
6fd601bc3b
Most of a red-black tree implementation for wmem, based heavily on the emem
...
version.
One plane trip's worth of work.
svn path=/trunk/; revision=49945
2013-06-15 10:40:56 +00:00