summaryrefslogtreecommitdiff
path: root/epan/wmem
AgeCommit message (Collapse)AuthorFilesLines
2013-07-15Fix warnings: format '%blah' expects argument of type 'foo', but argument ↵Chris Maynard1-3/+5
'i' has type 'bar' [-Wformat]. svn path=/trunk/; revision=50639
2013-07-06Add wmem_array_sort() which just hands off to the standard library's qsort().Evan Huus3-1/+42
svn path=/trunk/; revision=50411
2013-07-06In some versions of some OSes, even <string.h> declares index() underGuy Harris2-4/+4
some circumstances. Use array_index as a variable name instead, to avoid warnings. svn path=/trunk/; revision=50404
2013-07-06Trivial code style: use wmem_new in a few places, and remove extraneousEvan Huus2-3/+3
whitespace. svn path=/trunk/; revision=50401
2013-07-06Simple growable array implementation for wmem.Evan Huus5-0/+300
svn path=/trunk/; revision=50400
2013-06-27*sigh*Evan Huus1-3/+5
From the comment above wmem_tree_insert32_array(): * If you use ...32_array() calls you MUST make sure that every single node * you add to a specific tree always has a key of exactly the same number of * keylen words or things will most likely crash. Or at least that every single * item that sits behind the same top level node always have exactly the same * number of words. So clearly generating thousands of keys with random lengths while testing is going to cause problems. Generate a set of random lengths, then use those lengths consistently (but still generating random keys of those lengths). Should hopefully fix the intermittent build-bot failures. (unfortunately this does not manifest nicely, and I cannot see an easy way to assert it so that we catch other people trying to use different-length key subtrees) svn path=/trunk/; revision=50184
2013-06-27Misc little cleanups to wmem tree (comments, whitespace, assertions)Evan Huus1-9/+4
svn path=/trunk/; revision=50182
2013-06-27Remove debugging lines from wmem_test, I think I've figured out the problem.Evan Huus1-26/+0
svn path=/trunk/; revision=50181
2013-06-25Arrays seems to be where the failure is, so remove excess verbiage around otherEvan Huus1-47/+19
tests, and add more details to that section. Now we wait for the buildbots to fail again... svn path=/trunk/; revision=50156
2013-06-25makefile.nmake -> Makefile.nmake and minor whitespace (spaces -> tabs) changes.Chris Maynard1-1/+1
svn path=/trunk/; revision=50140
2013-06-24Fix wmem_tree.h ifdef guards, hopefully fixing the check-abi buildbot.Evan Huus1-2/+2
svn path=/trunk/; revision=50132
2013-06-24So it comes to this...Evan Huus1-0/+54
Put in a whole bunch of stderr output in the wmem tree tests in the hopes that the next time one of the buildbots randomly (and irreproducibly) fails on this step we'll have at least a bit of a hint as to where it happened. svn path=/trunk/; revision=50131
2013-06-22Make assertions in tree lookup more useful and fix formatting.Evan Huus1-8/+7
Should help debugging https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8833 svn path=/trunk/; revision=50115
2013-06-20From Michal Labedzki viaEvan Huus1-1/+1
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8824 Convert bluetooth emem trees to wmem trees. Add modelines and fix indentation. Correct typo in wmem_tree.h that still referred to emem. svn path=/trunk/; revision=50076
2013-06-19Rework wmem scoping limits so that users can still get a handle to a pool whenEvan Huus4-28/+32
it is out of scope, they just can't *allocate* in the pool. This is necessary because file-scope trees (migrating from emem) are set up on program initialization when there is no file in scope - they need to initialize with the handle, they just won't use it until a file is actually in scope. svn path=/trunk/; revision=50046
2013-06-19Add wmem_strbuf_new_label as just a sized new for label lengths.Evan Huus1-0/+3
svn path=/trunk/; revision=50039
2013-06-19Clean up wmem_strsplit to remove a bunch of weird switch statements andEvan Huus1-21/+16
unnecessary continue statements. Should fix the coverity issues Joerg pointed out as well. svn path=/trunk/; revision=50033
2013-06-18Resurrect wmem_memdup in its own misc. utilities group. Emem provides it, so weEvan Huus5-0/+159
need to provide an analogue at least for now. svn path=/trunk/; revision=50018
2013-06-18Add wmem_alloc_array, wmem_strsplit, wmem_strconcat.Evan Huus4-27/+195
svn path=/trunk/; revision=50017
2013-06-18Refactor insert32 to use lookup_or_insert32 with the right flags.Evan Huus1-59/+17
svn path=/trunk/; revision=50013
2013-06-18Refactor lookup_or_insert32 to remove a bunch of continue and break statementsEvan Huus1-29/+24
as well as a confusing while(TRUE). svn path=/trunk/; revision=50012
2013-06-18Simplify node structure. Use a boolean for whether or not it's a subtree, and anEvan Huus1-34/+35
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-18Factor function for node creation out and use it in several places.Evan Huus1-55/+39
svn path=/trunk/; revision=50010
2013-06-18Scrap wmem_memdup, it's not actually as useful as I thought it would be.Evan Huus3-48/+0
svn path=/trunk/; revision=50009
2013-06-18Factor common code for red-black tree array lookups into a helper function andEvan Huus1-38/+12
use it for both direct lookups and less-than-or-equal-to lookups. svn path=/trunk/; revision=50008
2013-06-18Remove wmem_tree_create_subtree, it does nothing we can't do withEvan Huus1-16/+1
wmem_tree_new. svn path=/trunk/; revision=50007
2013-06-18Factor string-packing code into a common function to use in both insert_stringEvan Huus1-48/+25
and lookup_string. svn path=/trunk/; revision=50006
2013-06-18Add test block for wmem_tree_lookup32_array_le(), fix other tests where certainEvan Huus1-2/+26
random seeds would cause collisions and false failures. svn path=/trunk/; revision=50004
2013-06-18Wmem tree tests with non-trivial keys.Evan Huus1-3/+5
svn path=/trunk/; revision=50003
2013-06-18Re-port a bunch of the red-black tree code from wmem with fewer modifications,Evan Huus3-138/+315
and enable the tests. Lesson: make it work, *then* refactor it into sanity. svn path=/trunk/; revision=50002
2013-06-18Add tests for red-black tree array keys, if0-ed out until I can make them notEvan Huus1-4/+74
blow up. Not sure if the tests are wrong or if I broke something during the port from wmem... svn path=/trunk/; revision=49998
2013-06-17Extract some common code for array lookups, and replace some DISSECTOREvan Huus1-42/+18
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-17Fix the test to respect the new behaviour.Evan Huus1-1/+2
svn path=/trunk/; revision=49971
2013-06-17Much smarter handling of autoreset trees.Evan Huus2-9/+27
svn path=/trunk/; revision=49970
2013-06-16More callback tweaks, to permit unregistering a callback from the same placeEvan Huus6-24/+63
it was originally registered. svn path=/trunk/; revision=49969
2013-06-16Fix include to use "" not <> for local headers.Evan Huus1-1/+1
svn path=/trunk/; revision=49968
2013-06-16Rework the user callback code a bit to make it saner to use with the auto-resetEvan Huus6-37/+50
trees. svn path=/trunk/; revision=49966
2013-06-16Simplify the tree code slightly - just don't call the transform functionEvan Huus1-14/+11
if it's NULL, meaning we don't need to define an identity callback. svn path=/trunk/; revision=49962
2013-06-16Add warning comment to tree autoreset function about allocatorEvan Huus1-0/+6
destruction order, and note that it may need thinking about. svn path=/trunk/; revision=49952
2013-06-16Fix occasional wmem_test failure, allocator destruction order mattersEvan Huus1-4/+1
(should it?) svn path=/trunk/; revision=49951
2013-06-15Most of a red-black tree implementation for wmem, based heavily on the ememEvan Huus5-1/+966
version. One plane trip's worth of work. svn path=/trunk/; revision=49945
2013-06-09Add memdup function to wmem.Evan Huus3-0/+48
svn path=/trunk/; revision=49857
2013-05-26First batch of doxygen for wmem. Remove some things from README.wmem now thatEvan Huus6-7/+186
they're in doxygen instead. svn path=/trunk/; revision=49583
2013-05-22Minor refactor: make the framework responsible for allocating and freeing theEvan Huus9-65/+49
actual wmem_allocator_t structure. This simplifies the internal API and deduplicates a few alloc/free calls in the individual allocator implementations. I'd originally made the allocators responsible for this on purpose with the idea that they'd be able to optimize something clever based on the type of allocator, but that's clearly more work and complexity than it's worth given the small number of allocators we create/destroy. svn path=/trunk/; revision=49512
2013-05-20Make the minimum supported GLib version 2.16.Gerald Combs1-14/+0
svn path=/trunk/; revision=49444
2013-05-16Use a readable name for the wmem callback test. Warn that reallocing memoryEvan Huus1-5/+5
for which a callback is registered is also a fairly stupid thing to do. svn path=/trunk/; revision=49354
2013-05-08Round two of wmem cleanup callbacks. While the emem tree behaviour will requireEvan Huus9-80/+238
recurring callbacks, I suspect most other potential uses will be once-only, so make that possible, and improve the documentation on the remaining issues. Also separate out the code into its own files and the testing into its own test case. svn path=/trunk/; revision=49209
2013-05-07Add user callbacks to wmem. This feature is a generic way to transparently mimicEvan Huus6-8/+157
the behaviour emem has for seasonal trees, which is that the master tree structure is not actually seasonal - it is permanent. When the seasonal memory pool is cleared, the root node pointer in all of these permanent trees is set to NULL, and the pool takes care of actually freeing the nodes. Wmem can now mimic this by allocating the tree header struct in epan_scope(), allocating any node structs in file_scope(), and registering a callback on file_scope() that NULLs the pointer in the epan_scope() header. Yes, this is confusing, but it seemed simpler than adding manual callback registrations to every single dissector that currently uses seasonal trees. The callbacks may also be useful for other things that need cleanup (I'm thinking resource handles stored in wmem memory that need to be fclosed or what-have-you before they the handle is lost). As indicated by the number of caveats in README.wmem, the implementation probably needs a bit of work to make it safer/saner/more-useful. Thoughts (or patches!) in this direction are more than welcome. svn path=/trunk/; revision=49205
2013-05-04Stub out the wmem test suite for older Glibs. This should restoreEvan Huus1-0/+14
compatibility with GLIB 2.14. svn path=/trunk/; revision=49161
2013-04-30In part from Raúl Pérez Clavero via ↵Evan Huus3-0/+50
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8275 Implement wmem_slist_append(). svn path=/trunk/; revision=49094