aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem/wmem_map.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-09Add wmem_map_get_keys.Michael Mann1-0/+24
Mimic functionality of g_hash_table_get_keys Change-Id: I7702854ed771a5b3bf7ea5295a67c42f0f477cdf Reviewed-on: https://code.wireshark.org/review/20039 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-09Add wmem_map_stealMichael Mann1-0/+29
Mimic functionality of g_hash_table_steal Change-Id: Iaf4aeef951b60934569143b2d119f782aeefe380 Reviewed-on: https://code.wireshark.org/review/20038 Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-28wmem: Delay creation of map table until its neededMichael Mann1-2/+4
wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), ...) doesn't have "file" scope ready at startup to create hash table and will assert. Change-Id: I3437f45ef42bf8635e4d504cf073fc3fb0c9a8cd Reviewed-on: https://code.wireshark.org/review/19825 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2017-01-28Add wmem_map_new_autoresetMichael Mann1-3/+84
This can be used similarly to wmem_tree_new_autoreset for hash tables that need reset after capture file change. Change-Id: I3a2f0b0a0cad3eca46266523c594d3d7aac17489 Reviewed-on: https://code.wireshark.org/review/19794 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2016-07-16wmem_map.c: Address some VS Code Analysis warnings.Michael Mann1-3/+4
size_t can vary on size, so you can't always mix it with guint. Change-Id: I7e2ea3a990dd4df99422f6113aa3ae53dbf2bc4f Reviewed-on: https://code.wireshark.org/review/16501 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-22wmem: add wmem_map_size().Dario Lombardo1-0/+6
Change-Id: I3acca7939466a4436e23bcf828ef94f927ce8b76 Reviewed-on: https://code.wireshark.org/review/15042 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-22wmem: add foreach function to wmem_map.Dario Lombardo1-0/+15
Makes wmem_map more similar to g_hash. Change-Id: Ia17a19ab0be8e07fbb64801d54db2ba8217a7fea Reviewed-on: https://code.wireshark.org/review/15020 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-18Fix warning: no previous prototype for ... [-Wmissing-prototypes]Alexis La Goutte1-0/+1
Change-Id: I59e744d905a0a13eea4ff649a984b2ed9f1f51e7 Reviewed-on: https://code.wireshark.org/review/3697 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-29Fix an extraneous parentheses warning.Gerald Combs1-1/+1
"if (G_UNLIKELY(...))" triggers an extraneous parentheses warning when compiling with XCode's clang-500.2.75. From looking at the macro definition we *should* be able to get rid of the outer parentheses everywhere. Change-Id: I710e1cc391e1167c1243c4ddb032f2831f0a9498 Reviewed-on: https://code.wireshark.org/review/1432 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-04-27Fix rare case of wmem map being O(n)Michael Mann1-0/+2
For 'x' equal to 0, HASH() macro also returns 0 which makes wmem map O(n). When random generator will return 0 just use 1. Change-Id: If484091352a719aea27135a705d37ff4c184a13b Reviewed-on: https://code.wireshark.org/review/1387 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-23Add a cast to satisfy mac buildbot.Evan Huus1-1/+1
Change-Id: I625b025d3f8a57812512497c6104977ae5d10232 Reviewed-on: https://code.wireshark.org/review/1298 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-23Hash map implementation for wmem.Evan Huus1-0/+284
This has two expected uses: - Many current users of wmem_tree don't actually need the predecessor lookup it provides (the lookup_le function family). A hash map provides straight insertion and lookup much more efficiently than a wmem_tree when predecessor lookup isn't needed. - Many current users of glib's hash table and hash functions use untrusted data for keys, making them vulnerable to algorithmic complexity attacks. Care has been taken to make this implementation secure against such attacks, so it should be used whenever data is untrusted. In my benchmarks it is measurably slower than GHashTable, but not excessively so. Given the additional security it provides this seems like a reasonable trade-off (and it is still faster than a wmem_tree). Change-Id: I2d67a0d06029f14c153eaa42d5cfc774aefd9918 Reviewed-on: https://code.wireshark.org/review/1272 Reviewed-by: Evan Huus <eapache@gmail.com>