Commit Graph

339 Commits

Author SHA1 Message Date
Jaap Keuter 4ff9bddc46 wmem: fix rb-tree data printer feed
When using a data printer for the red/black tree it is fed with the
nodes of the tree. But nodes can be either subtree or data nodes.
Don't feed the subtree nodes to the data printer. The data printer can't
recognize it as such, can't handle it, or worse, could break stuff.

Change-Id: Ibbc1311d901c0d0c52e710f951dd53620f2c3d0f
Reviewed-on: https://code.wireshark.org/review/19652
Reviewed-by: Evan Huus <eapache@gmail.com>
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: Anders Broman <a.broman58@gmail.com>
2017-01-22 10:40:34 +00:00
João Valverde 04761f220b Add wmem_list_find_custom()
Change-Id: I5c4f85df0a1899d629386581de2c2c3ec0812d54
Reviewed-on: https://code.wireshark.org/review/18440
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-10-24 21:01:56 +00:00
Peter Wu 534787e402 cmake: make WERROR_COMMON_FLAGS a normal string
Instead of checking for the boolean "FALSE", just set an empty string.
This avoids the need to check for WERROR_COMMON_FLAGS before using it.

The transformation is the same for all files, remove
"if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since
we have a string here and not a list).

Modelines have been added where missing.

Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92
Reviewed-on: https://code.wireshark.org/review/17997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-30 20:08:02 +00:00
João Valverde 640382c743 CMake: Allow setting per target compiler warnings
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow
using different flags per target.

Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS
and using the COMPILE_OPTIONS property to set them.

This change is just setting mechanism and there should be no difference
in generated warnings.

The check_X_compiler_flag cmake test is changed to test each flag individually.
We need a list, not a space separated string, and the aggregate test is not
significant.

Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25
Reviewed-on: https://code.wireshark.org/review/17150
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-23 21:33:09 +00:00
Michael Mann e302d9fe4d Remove checkAPI warnings from wmem.
printf and g_warning are not allowed in epan or its subdirectories

Change-Id: I4c07a7258f4c9566384bef93af35c350b5c88758
Reviewed-on: https://code.wireshark.org/review/16801
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-08-01 04:21:22 +00:00
Guy Harris c2ac9c5c03 Use correct relative path.
The build is done in epan/wmem, so libwsutil.la is in ../../wsutil.

Change-Id: I053f6b925829e9c5e9ded014fbc716abc527b46a
Reviewed-on: https://code.wireshark.org/review/16790
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-30 20:51:00 +00:00
Guy Harris f6322a4977 ifdef out a variable used only on Windows.
Also, fix identation - tab stops are set every 8 spaces, not every 4
spaces, in UN*X, which is why the mode lines specify that.

Change-Id: If7cfc2cdae26feb2d5c13e31a32ed950354fb15b
Reviewed-on: https://code.wireshark.org/review/16789
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-30 20:39:13 +00:00
Gerald Combs 183d7f3b78 Add string function times to wmem_test.
The system, GLib, and wmem string functions can perform differently,
particularly on Windows. Start adding performance tests to wmem_test so
that we can see the differences.

With this change applied "wmem_test --verbose" prints out the following
on a Windows 7 x64 VM here. wmem_test is linked against GLib 2.4.20.

(MINPERF:g_printf_string_upper_bound (via g_snprintf) 1 string: u 327.602 ms s 0
.000 ms)
(MINPERF:g_printf_string_upper_bound (via g_snprintf) 5 strings: u 1419.609 ms s
 0.000 ms)
(MINPERF:g_printf_string_upper_bound (via g_snprintf) mixed args: u 1606.810 ms
s 0.000 ms)
(MINPERF:_snprintf_s upper bound 1 string: u 124.801 ms s 0.000 ms)
(MINPERF:_snprintf_s upper bound 5 strings: u 140.401 ms s 0.000 ms)
(MINPERF:_snprintf_s upper bound mixed args: u 124.801 ms s 0.000 ms)
(MINPERF:g_strdup_printf 2 strings: u 702.005 ms s 0.156 ms)
(MINPERF:g_strconcat 2 strings: u 78.000 ms s 0.000 ms)
(MINPERF:g_strdup_printf 5 strings: u 1419.609 ms s 0.156 ms)
(MINPERF:g_strconcat 5 strings: u 93.601 ms s 0.156 ms)
(MINPERF:wmem_strdup_printf 2 strings: u 343.202 ms s 0.312 ms)
(MINPERF:wmem_strconcat 2 strings: u 93.601 ms s 0.468 ms)
(MINPERF:wmem_strdup_printf 5 strings: u 327.602 ms s 8.268 ms)
(MINPERF:wmem_strconcat 5 strings: u 62.400 ms s 3.432 ms)

Change-Id: Id9b23918829db1719d141e7f830b9eba6245a25b
Reviewed-on: https://code.wireshark.org/review/14857
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-30 16:29:36 +00:00
Michael Mann 6d8ea38773 wmem_map.c: Address some VS Code Analysis warnings.
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-07-16 19:46:05 +00:00
Jeff Morriss e59460348f Reinstate the wmem test-programs target.
It's used when building the test programs (today wmem has only one but it
might someday have more).

Change-Id: I627513e1297b8348bf034e852eaf212ddbef96ff
Reviewed-on: https://code.wireshark.org/review/16221
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2016-06-30 19:02:12 +00:00
João Valverde a16d401b25 Remove Makefile.common files
Now that nmake build system has been removed they are not needed anymore.

Change-Id: I88075f955bb4349185859c1af4be22e53de5850f
Reviewed-on: https://code.wireshark.org/review/16050
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-06-30 11:04:17 +00:00
Pascal Quantin 6baa1b544c Remove Nmake build system
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61
Reviewed-on: https://code.wireshark.org/review/15777
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-15 19:21:57 +00:00
Evan Huus 3ace225e0d Document wmem null guarantee
Change-Id: Ibbbda815b144441f7db2d1920e1551c45e997370
Reviewed-on: https://code.wireshark.org/review/15549
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-05-24 07:18:03 +00:00
Michael Mann 32a2167698 Run checkAPIs in epan/wmem/
Was fixed to pass.  Let's keep it that way.

Change-Id: I49b532b6f1df2430b3912f8f1e9d518caff17d2c
Reviewed-on: https://code.wireshark.org/review/15413
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-13 16:01:38 +00:00
Michael Mann 4d4190f127 Have wmem conform to checkAPIs.pl
Yes, the rename of structure members is a bit hacky.
Yes, catering to Windows since "GLib's v*printf routines are
surprisingly slow on Windows".
But it does pass checkAPIs.pl

Change-Id: I5b1552472c83aa2e159f17b5b7eb70b37d03eff9
Reviewed-on: https://code.wireshark.org/review/15404
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-13 16:00:58 +00:00
Michael Mann 9d08ef3f63 Remove strcpy from wmem_strbuf.c
This removes all strcpy calls from Wireshark provided code
(only ones remaining are in lemon.c)

Change-Id: I7a467fc3e10cc94c97196ecea3277a5375bc14b7
Reviewed-on: https://code.wireshark.org/review/15347
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-11 03:16:43 +00:00
Dario Lombardo fc3885fd51 wmem: add wmem_map_size().
Change-Id: I3acca7939466a4436e23bcf828ef94f927ce8b76
Reviewed-on: https://code.wireshark.org/review/15042
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-22 04:34:45 +00:00
Dario Lombardo fe75c87575 wmem: add foreach function to wmem_map.
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>
2016-04-22 04:33:58 +00:00
Dario Lombardo 07e270124e wmem: add foreach function to wmem_list.
Makes wmem_list more similar to glib lists.

Change-Id: Ifadf0627791a72c4118a14f205aa1a7189894d27
Reviewed-on: https://code.wireshark.org/review/15019
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-20 21:11:49 +00:00
João Valverde 173ccf7a46 More test-programs autotoolizing
Change-Id: I3e16dc8c591352f19bba190d84a6ed3fe431e21f
Reviewed-on: https://code.wireshark.org/review/14926
Reviewed-by: João Valverde <j@v6e.pt>
2016-04-17 01:37:55 +00:00
Gerald Combs a8ebc3dcf5 Wmem: Use the native v*printf routines on Windows.
GLib's v*printf routines are close to unreasonably slow on
Windows. Use the native CRT routines in wmem_strdup_vprintf and
wmem_strbuf_append_vprintf on that platform.

Change-Id: I5e94aa6fe47434e5a18f3a4d5b6b24ebe71499c1
Reviewed-on: https://code.wireshark.org/review/14868
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-09 10:44:17 +00:00
Matthieu Coudron 6bef7ffc89 Improves MPTCP analysis
Adds options that control depth of MPTCP analysis, notably:
- if mptcp_relative_seq is enabled, can display relative MPTCP sequence
  numbers
- if mapping analysis is allowed, can tell in which packets the DSS
  mappings covering this data was sent
- if intersubflow checks are enabled, it can check for retransmissions
  over other subflows

Change-Id: I82b934513c9f16affb60c066a1fbcca234ffc999
Reviewed-on: https://code.wireshark.org/review/12316
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-26 19:15:25 +00:00
João Valverde 6b54fbf3bf CMake: Add more structure to libwireshark build
Smaller epan/CMakeLists.txt is easier to work with and this structure
is well suited to CMake. It should make it easier to manage and configure
each epan module differently if necessary.

Change-Id: Ia649db3b7dcd405aa43dbdba3288699d5e375229
Reviewed-on: https://code.wireshark.org/review/14068
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-01 19:23:39 +00:00
Dario Lombardo 37acf433db wmem: add null-terminator support.
This change makes wmem_array more similar to GArray by adding
two functions that mimic the first two params of g_array_new().

Change-Id: Iaec999cd2e44f79f44d766be5d39741b73602e5a
Reviewed-on: https://code.wireshark.org/review/13989
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2016-02-22 19:55:33 +00:00
João Valverde f0fb79d534 autotools: Use pkg-config autoconf macros for GLib/GTK
Remove mostly obsolete aclocal macros. Make GTK build flags a strict superset
of GLib flags. Use GTK build variables for GTK GUI and GLib elsewhere. Add
dependency flags explicitly instead of using WS_CPPFLAGS.

Some minor improvements and fixes for missing/unnecessary variables (no impact
on our test builds).

Change-Id: I3e1f067a875f79d6516c1fa7af986f17a7a6b671
Reviewed-on: https://code.wireshark.org/review/14005
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-21 07:51:55 +00:00
João Valverde 265a41e14d autotools: Don't use "user variables" to set build flags
GNU coding standards recommend against it and automake is designed
around it.

This allows overriding the global build flags using AM_CFLAGS, etc.,
or per object flags, something that is difficult or impossible currently
because of automake precedence rules.

Change-Id: I3f1ea12e560af5a46b2f04b342b1882bbf123f12
Reviewed-on: https://code.wireshark.org/review/13455
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-28 18:13:48 +00:00
Alexis La Goutte 0cc17787d6 api ref (wmem_interval_tree): fix end of file while inside a group
Change-Id: I68fbe85a8a7e3f0181fc84151fa8f58c459fd46a
Reviewed-on: https://code.wireshark.org/review/13542
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-26 09:07:46 +00:00
Matthieu Coudron 0d3f77fff1 Adds wmem_list_find function
Change-Id: I72162210b830a57978e108032d75d8c54f17d16b
Reviewed-on: https://code.wireshark.org/review/12387
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-04 04:00:48 +00:00
Dario Lombardo 83c8cd2f27 wmem: add initializer (CID 1340194).
Change-Id: I7b3d7a95af213a198b62c1475ba2125f8fe37ee6
Reviewed-on: https://code.wireshark.org/review/12142
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-11-25 21:19:18 +00:00
Guy Harris 571ed4d259 Print guint64's with G_GUINT64_FORMAT.
There is no guarantee that they will be long's, and thus no guarantee
that they can be printed with "%lu".

Change-Id: I5c2ff844a1024332f01dec58489a2d304ba4e7ce
Reviewed-on: https://code.wireshark.org/review/12135
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-25 11:34:08 +00:00
Guy Harris b73e812fe7 No declarations in the middle of code.
We crank up pedantic warnings enough that this provokes "warning: ISO
C90 forbids mixed declarations and code" on the OS X 10.5 buildbot.

Change-Id: Ic3962f20d85e3ed003b84b298f83d12c3ae25ea1
Reviewed-on: https://code.wireshark.org/review/12120
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-25 02:49:32 +00:00
Guy Harris b9c50236af Avoid colliding definitions of wmem_tree_t.
Change-Id: I643eae3c35f96591770ab03ce44a85c806f17e1c
Reviewed-on: https://code.wireshark.org/review/12119
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-24 23:41:22 +00:00
Matthieu Coudron bd08ab920d Introduces augmented interval trees
Interval trees (wmem_itree_t) are implemented as an extension of wmem_tree with a
guint64-based range as the key.
This is useful for instance in MPTCP analysis, to look for packets
matching a range defined by a mapping across TCP subflows.

Change-Id: Iea706d44fe975e390a4191ad0257ef37d5c71525
Reviewed-on: https://code.wireshark.org/review/11714
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-24 23:02:09 +00:00
Matthieu Coudron c2afc9edec Change prototype of callbacks passed to wmem_tree_foreach so that they
accept the node key as a first parameter.

wmem_tree accepts all sort of keys (strings, integers, soon ranges),
thus it is of interest for various purposes (testing, greedy search) to
know the key of the node.

Change-Id: Ie748b917bef91f0b1ba8cce15bd1b471922641dc
Reviewed-on: https://code.wireshark.org/review/11683
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-11 00:22:37 +00:00
Stig Bjørlykke 58ec64c36e wmem: Fix wmem_tree_remove_string
Always set is_removed when insert data in a node.

Change-Id: I8fb50932a369e3f4fe8a1f743462683fff705cc2
Reviewed-on: https://code.wireshark.org/review/9978
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-11 19:55:01 +00:00
Stig Bjørlykke d6c6b0899d wmem: Mark removed strings with is_removed
This will allow integer value 0 again.

Change-Id: Ibfa4249ea8b887971d3b3214ad9e4d095d20d155
Reviewed-on: https://code.wireshark.org/review/9973
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-11 14:15:49 +00:00
Stig Bjørlykke ecc4f756bd Added Reload Lua plugins.
This is initial support for reloading Lua plugins without
restarting the application.

Still todo:
- Deregister FileHandlers
- Support deregister ProtoField with existing abbrev (same_name_hfinfo)
- Add a progress dialog when reloading many plugins
- Search for memory leakages in wslua functions

Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1
Reviewed-on: https://code.wireshark.org/review/5028
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-11 12:09:07 +00:00
Evan Huus eaf1aad31e wmem: don't remove tiny blocks from the recycler
They were never put in it in the first place because they can't hold the
necessary pointers.

Bug: 11373
Change-Id: I9e2ec76850929b5ac86e6f7a344d70f56ad3911c
Reviewed-on: https://code.wireshark.org/review/9672
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-07-17 02:37:13 +00:00
Evan Huus ebae0c98f8 store tcp/udp port names in epan scope
This causes them to be freed on shutdown, cleaning up ~800KB of "reachable"
memory according to valgrind. The fact that we even need to construct these as
value_strings is questionable IMHO, but that's a problem for a later date.

Switch epan_scope to the BLOCK allocator now that we're using it for so much
more, this gives a small but measurable increase in startup time.

Change-Id: I187460b769e28da3c6629abac1d9196727ae7dde
Reviewed-on: https://code.wireshark.org/review/9483
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-07-04 12:21:34 +00:00
Evan Huus b855a9fa4d wmem: permit lookups in NULL trees (oops)
Change-Id: I222b95b48b7ac8debbd717b32dd471742222c16b
Reviewed-on: https://code.wireshark.org/review/9177
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-26 18:40:46 +00:00
Evan Huus 66c738817c wmem: convert string trees to single-layer
The whole radix tree thing is kind of neat (and may even be more performant for
short strings?) but it's really confusing to reason about and is terribly
inefficient for long strings.

Ping-Bug: 9078
Change-Id: I1bd333918a6e557801e82f4553d386120138065e
Reviewed-on: https://code.wireshark.org/review/9165
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-26 18:35:47 +00:00
Evan Huus d81ba670a1 wmem: bubble up key type change another function
Follow-up to gb679e2a.

Change-Id: I6cc168c3f3a6e1c8ce7bfa9344255acd3c8a7d20
Reviewed-on: https://code.wireshark.org/review/9164
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-25 22:26:12 +00:00
Evan Huus b679e2aab5 wmem: convert tree key to void*
Rather than forcing everything to live in guint32. We still use guints for now
via the G_POINTER_TO_UINT and vice-versa, but this paves the way in future for
custom comparison functions which will make e.g. string trees far more
efficient for long strings.

Change-Id: Ibb15400f74761ae295948507df8d2e022f2ebb05
Reviewed-on: https://code.wireshark.org/review/9138
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-25 18:14:37 +00:00
Gerald Combs f074647d2b Add a test-programs target everywhere.
Add a "test-programs" target to each toolchain which builds each unit
test executable. "test-programs" must now be built before running
the unit test suite.

Change-Id: I9317a1e305d987f244c4bd8b4a7f05d11fed7090
Reviewed-on: https://code.wireshark.org/review/7673
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-13 22:41:40 +00:00
Alexis La Goutte 0a2832c4be WMEM (allocator): fix warning: redeclaration of already-defined enum '_wmem_allocator_type_t' is a GNU extension [-Wgnu-redeclared-enum]
Change-Id: Ied0428324c14f248bf6857fd288b4fb5d4591230
Reviewed-on: https://code.wireshark.org/review/7033
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-08 22:34:22 +00:00
Hadriel Kaplan aec1bcf9a1 Lua can free tvbuffs too early
Lua-created tvbuffs should be kept around for the duration of pinfo's
lifetime, instead of only for the duration of frame dissection. So
instead of using the frame dissector's frame_end_routine, we'll register
a callback to wmem for pinfo pool's allocator.

Bug: 10888
Change-Id: I3e9db671c3f2a7cab9e258aca17f3be8acaf2417
Reviewed-on: https://code.wireshark.org/review/6768
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-25 19:11:01 +00:00
Bill Meier 5c529c95c5 Add '*.nativecodeanalysis.xml' to 'clean' targets
Change-Id: I90dbf0b31fc737150a01533763a7869b34c68cb6
Reviewed-on: https://code.wireshark.org/review/6220
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-02 01:45:16 +00:00
Guy Harris 2b6c267a57 Eliminate use of ctype.h routines.
That way, we don't do locale-sensitive case-insensitivity (yes, the
locale can affect case-mapping - in a Turkish locale, "I" isn't the
upper-case version of "i", for example).

Change-Id: I5f7663e85160558ff3769617f924e45049c9c384
Reviewed-on: https://code.wireshark.org/review/4843
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-19 22:45:27 +00:00
Bill Meier 0784451200 Adjust some whitespace to match editor modelines.
Change-Id: I9fda7de49255857cc1cf270d6202c85573d91674
Reviewed-on: https://code.wireshark.org/review/4490
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-06 03:42:51 +00:00
Bill Meier 07698d536b Adjust some whitespace to match editor modelines.
Change-Id: Ia22cac3ebd7a454c156f98d967e6fd61f708a2b3
Reviewed-on: https://code.wireshark.org/review/4489
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-06 02:55:49 +00:00
Gerald Combs 983ae6cade Fix the patch-bzip2 target.
The main site URI scheme is now https. Update the URL in some other
places while we're here.

Change-Id: Ib03d4fd1c58dabd3cf5050dc4f79216e0b94d525
Reviewed-on: https://code.wireshark.org/review/4133
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-16 20:16:26 +00:00
Alexis La Goutte 3adbd93771 Fix warning: no previous prototype for ... [-Wmissing-prototypes]
Change-Id: I59e744d905a0a13eea4ff649a984b2ed9f1f51e7
Reviewed-on: https://code.wireshark.org/review/3697
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-18 13:13:43 +00:00
Evan Huus 0294b29527 Try to detect overflow without causing signedness warnings.
Change-Id: I957ead1f674e2c56e9c741841fea11395769b238
Reviewed-on: https://code.wireshark.org/review/3398
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-08-04 00:32:15 +00:00
Evan Huus efb8a1ee43 Check for multiplicative overflow in the wmem_alloc_array macros.
Bug:10343
Change-Id: Iea511c806b92999b3b497f94886c46a818100a23
Reviewed-on: https://code.wireshark.org/review/3396
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-04 00:08:19 +00:00
Evan Huus 9dc3d67672 wmem: get rid of the allocator timing test
Some of the allocators are close enough that a little bit of system load at the
time of the test was enough to throw them off, and it was causing unnecessary
buildbot failures. Benchmarking on real-world cases at the time of
implementation (as well as reliable "average" results on the buildbots) has left
me confident that block_fast is, in fact, faster than block, which is faster
than simple/strict.

Additionally, the allocators are effectively "done" and unlikely to change, so
the possibility of uncaught performance regressions is low.

Change-Id: I144ea4cd9d6000edc4075ed682ce6a4aeaf5e28a
Reviewed-on: https://code.wireshark.org/review/3356
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-03 07:36:04 +00:00
Evan Huus ab1e6f30d2 Bump (again) the amount of work we do for wmem's timing test
Apparently the new win8 vm has a *very* low-resolution timer, and the allocators
are indistinguishable at the previous amount of work.

Change-Id: If4e5bb8f85b1f0d39658f54001c88f42ffddfc47
Reviewed-on: https://code.wireshark.org/review/2768
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-01 23:48:41 +00:00
Alexis La Goutte bb78e8f6e5 Add Modelines and use tabs and fix typo
Change-Id: Ie3f60f66f0f4a572098d1d7425c53aaf51bdb747
Reviewed-on: https://code.wireshark.org/review/1846
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-28 23:43:46 +00:00
Evan Huus 1f265368c4 Add jumbo-allocation support to wmem fast block
As it turns out, we do occasionally need it.

Bug:10115
Change-Id: Ifec79e4d2470bbc09f15674534d01418a6571a0d
Reviewed-on: https://code.wireshark.org/review/1688
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-23 03:37:53 +00:00
Gerald Combs bb01c7ac38 Remove extra parentheses.
Fix the clang warning

epan/wmem/wmem_allocator_simple.c:49:27: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
    if ((allocator->count == allocator->size)) {
         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~

We might want to add -Wno-parentheses-equality to the compiler flag
list but I'm not sure if doing so would hide valid problems.

Change-Id: Id59b55af1411f13309fbec77870f869e04a6f49f
Reviewed-on: https://code.wireshark.org/review/1717
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-05-21 17:44:26 +00:00
Evan Huus 9fe221a42f Fix newly optimized strdup_vprintf.
As Jakub pointed out, our +1/-1 logic for null terminators wasn't quite right.
Also be sure to re-copy the va_list parameter if we need to re-use it, as
otherwise things break oddly.

Change-Id: Ibeaa95af602f565791e9378a6cfce434f13025eb
Reviewed-on: https://code.wireshark.org/review/1670
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-17 12:30:03 +00:00
Jakub Zawadzki 72a6a8cb5c Fixes after wmem_strdup_vprintf() optimization
- g_vsnprintf()[1] buffer size can includes space for terminating NUL,
  this simplifies code, and fix problems with string truncation

- g_vsnprintf() returns number of bytes without terminating NUL, so we
  need to do + 1

- second g_vsnprintf() call use already consumed 'ap2' va_arg, which
  makes wmem_strdup_vprintf() doesn't work/ crash for FORMATTED string length > 80

[1] https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-vsnprintf

Change-Id: I0ebb7f452e3e89c9b55f8ac889166f02e8a7c982
Reviewed-on: https://code.wireshark.org/review/1667
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-17 12:20:50 +00:00
AndersBroman a42df4818f Use a pre allocated buffer in wmem_strdup_vprintf() reduces the function
cost by more than half.

Change-Id: I6ad2ae407325d2091ffb60919cb3ed74f78f39fa
Reviewed-on: https://code.wireshark.org/review/1662
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-17 07:21:07 +00:00
Evan Huus 44191fc05b Dumber "simple" wmem allocator.
Instead of maintaining a hash table, just alloc a really big array of pointers.
This is theoretically bad since it means frees and reallocs become O(n), but in
practice it makes the capture from bug 10098 run about 20% faster under
valgrind. This makes sense, since the workload is heavily dominated by
allocations, and most frees/reallocs are recently allocated (so they will be
found quickly at the beginning of the scan).

Bug:10098
Change-Id: I7097ad0653d3fb5f4f723cc84046cbc4450e3494
Reviewed-on: https://code.wireshark.org/review/1602
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13 04:21:21 +00:00
Evan Huus f764765108 Increase the work used to time wmem allocators
It appears that on some platforms the timer underlying g_test_timer() is
relatively low-precision, so the small amount of work that we were previously
doing was not enough for the timer to provide a useful value.

Bumping the amount of work should provide more meaningful values, and the whole
timing step still takes only a few seconds.

Change-Id: Idce1386eaa33add845d9a2758b0beb72bbf370d6
Reviewed-on: https://code.wireshark.org/review/1523
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-06 02:30:05 +00:00
Evan Huus 93619389ea Fix dead assignment found by clang in test code
Change-Id: Ie78769bfd8034f6c2ee7d9e26a209d650cedb98d
Reviewed-on: https://code.wireshark.org/review/1507
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-05-05 13:08:44 +00:00
Evan Huus 402bbcbd05 Reduce wmem fast-block fuzz rounds even further
Follow-up to g19e650f43adf23b0aa92821bff0cc389643944f6 since the fuzz-bot is
still failing.

Change-Id: I2d05a861b0edf50ce734b682e6e3e33729bf6771
Reviewed-on: https://code.wireshark.org/review/1503
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-05 11:32:19 +00:00
Evan Huus 16dfe11b24 Several tweaks to fast block allocator
- manually inline wmem_block_fast_add_to_block_list, it was only two lines and
  only called twice, so the function boilerplate was outweighing the abstraction

- change free_all to release all but one block to the OS immediately, making gc
  a no-op; the alloc logic doesn't reuse later blocks anyways, so this was
  effectively a leak

Change-Id: I033fbb2f3d87e58c7346cba10f2c710eaaa49e9f
Reviewed-on: https://code.wireshark.org/review/1499
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-05 06:05:18 +00:00
Jakub Zawadzki f13bbf2707 Fast block allocator: make wmem_block_fast_hdr_t single linked list.
Double linked list was required by jumbo allocation.
No support for jumbo -> no need for double linked list -> have only 'next' pointer in header.

Change-Id: I48a0f468ebba9db3a63548d8e7307b6424c759ed
Reviewed-on: https://code.wireshark.org/review/1495
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-05 03:57:51 +00:00
Evan Huus 19e650f43a Fuzz fewer iterations of the fast block allocator
I believe the XP buildbot failures are simply running out of memory, so
hopefully reducing the number of iterations should be enough to let it finish
reliably.

Change-Id: I40af789d528c2623e95f153529205b5e617c6e02
Reviewed-on: https://code.wireshark.org/review/1496
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-04 22:24:44 +00:00
Jakub Zawadzki 5f239013e7 wmem: add new simple block allocator, use it in packet-scope.
For packet-scope allocation, there's no need to support realloc(), free()
cause memory will be garbage collected after packet dissection.

(and this allocator is much faster than full block allocator).

Change-Id: I73fdf708c3077f48f55bdcc71f4fa859e4ac2335
Reviewed-on: https://code.wireshark.org/review/1428
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-02 21:07:07 +00:00
Evan Huus abc387934b Reintroduce wmem_allocator_force_new
We now have to call wmem_init in order to randomly seed the values for wmem_map.
This means we can no longer rely on the lack of override, so we have to force
the right allocator type when testing/timing the allocators themselves.

Change-Id: I005034465b0a98f19876899b96ef65b3e4b1d759
Reviewed-on: https://code.wireshark.org/review/1468
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-02 14:37:53 +00:00
Evan Huus f181756640 Optimize wmem_strbuf_grow.
As suggested by Anders, in the case of repeated calls to wmem_strbuf_append_c
(and other functions which append very little data) the growth check was a
substantial portion of the over-all running time. By short-circuiting the check
in the case where growth isn't needed (as opposed to letting it fall-through
naturally) we shave ~25% off the cost of such repeated calls in my benchmarks.

The function (wmem_strbuf_grow) is inline, so the compiler should be able to
optimize each caller individually for the short-circuit.

Change-Id: I76419020f4d8fa675906eb77798969b6c61c7732
Reviewed-on: https://code.wireshark.org/review/1467
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-02 14:34:50 +00:00
Alexis La Goutte 9cdba46251 Fix indent (Use Tab)
Change-Id: I811fb3db41a31d2334eb80f1821beea109bfa0d9
Reviewed-on: https://code.wireshark.org/review/1437
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-30 11:36:12 +00:00
Gerald Combs b60ccf6dae Fix an extraneous parentheses warning.
"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-29 15:35:29 +00:00
Michael Mann 98ed927290 Fix rare case of wmem map being O(n)
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-27 21:55:53 +00:00
Stig Bjørlykke bd38b3152d Support out-of-source checkapi
Always call $(top_srcdir)/tools/checkAPIs.pl with -sourcedir=$(srcdir)
from Makefile.am to allow out-of-source 'make checkapi'.

Change-Id: I60d7e0079984a8ededdacf4517a0738486fa7973
Reviewed-on: https://code.wireshark.org/review/1294
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-25 04:23:46 +00:00
Evan Huus f0e77aa366 Add a cast to satisfy mac buildbot.
Change-Id: I625b025d3f8a57812512497c6104977ae5d10232
Reviewed-on: https://code.wireshark.org/review/1298
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-23 12:58:53 +00:00
Evan Huus 9ba4c6e091 Hash map implementation for wmem.
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>
2014-04-23 12:42:26 +00:00
Evan Huus 1a6e9b5d70 Much faster implementation of 'strict' allocator.
Rather than using a hash table, which is overkill and slow, embed a
doubly-linked-list in the prefix structure.

On my tests with some random capture file and tshark -nxVr:
- normal block allocator: ~2.1 seconds
- old (slow) strict allocator: ~4.2 seconds
- new (fast) strict allocator: ~2.8 seconds

The buildbot will thank me :)

Change-Id: I2fb42229c4ee4c40bbe45ba04b7848792998eaa9
Reviewed-on: https://code.wireshark.org/review/1251
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-22 06:15:21 +00:00
Alexis La Goutte 38d5b11fa2 Fix warning when build with -Wdocumentation
epan/wmem/wmem_strutl.h:85:63: error: parameter 'str' is already documented [-Werror,-Wdocumentation]
epan/wmem/wmem_strutl.h:85:27: note: previous documentation
epan/wmem/wmem_strutl.h:90:39: error: parameter 'str' is already documented [-Werror,-Wdocumentation]
epan/wmem/wmem_strutl.h:85:57: note: previous documentation
epan/wmem/wmem_strutl.h:83:11: error: parameter 'allocator:' not found in the function declaration
epan/wmem/wmem_strutl.h:83:11: note: did you mean 'allocator'?
epan/wmem/wmem_strutl.h:84:11: error: parameter 'str:' not found in the function declaration [-Werror,-Wdocumentation]
epan/wmem/wmem_strutl.h:85:11: error: parameter 'len:' not found in the function declaration [-Werror,-Wdocumentation]
epan/wmem/wmem_strutl.h:85:11: note: did you mean 'len'?

Change-Id: Id2888c5967c94c48f9b53957c8be361bbebd3488
Reviewed-on: https://code.wireshark.org/review/1151
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-15 14:40:05 +00:00
Alexis La Goutte 1fceb512f7 Fix warning when generate documentation (doxygen)
epan/wmem/wmem_strutl.h:82: warning: Found unknown command `\allocator'
epan/wmem/wmem_strutl.h:82: warning: Found unknown command `\allocator'
epan/wmem/wmem_strutl.h:80: warning: Found unknown command `\str'
epan/wmem/wmem_strutl.h:81: warning: Found unknown command `\len'
epan/wmem/wmem_strutl.h:81: warning: Found unknown command `\str'
epan/wmem/wmem_strutl.h:81: warning: Found unknown command `\st

Change-Id: I0c3908f0e4aa84cc20fad954638b0cb10b1d6dee
Reviewed-on: https://code.wireshark.org/review/1131
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14 20:19:36 +00:00
Alexis La Goutte 05ce6efb8c Fix warning when generate documentation (doxygen)
wireshark/epan/wmem/wmem_stack.h:39: Warning: group wmem-stack: ignoring title "Stack-bbab" that does not match old title "Queue"

Change-Id: I9376651d89d9df21aeca82ddb952c230d546169a
Reviewed-on: https://code.wireshark.org/review/1130
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14 20:18:29 +00:00
Evan Huus 5ad84a9ed1 Fix non-standard format specifiers
C90 permits plain %f for doubles. Thanks to Alexis for pointing this out.

Change-Id: I3f927b0a50e5764c2297c7f9d680c6363ba9fd0e
Reviewed-on: https://code.wireshark.org/review/1073
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-12 00:25:38 +00:00
Evan Huus b238cd1541 Scrap wmem splay trees for now.
There is confusion about API usage, and problems on my part concerning whether
keys should be compared signed or unsigned, and how to do that efficiently.
Unsigned keys in particular were behaving oddly.

Change-Id: I075693bbd04c15f79f24f9a24006003a914cc572
Reviewed-on: https://code.wireshark.org/review/924
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-02 17:14:16 +00:00
Alexis La Goutte 757aa33220 Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\# \$Id\$/,+1 d') (start with dash)

Change-Id: Ia4b5a6c2302f6a531f6a86c1ec3a2f8205c8c2dd
Reviewed-on: https://code.wireshark.org/review/881
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 18:48:06 +00:00
Evan Huus a8f1e349c3 Doc tweaks and macro parameterization
Change-Id: I9898bedf05a785683e79866a149336cbbf402d27
Reviewed-on: https://code.wireshark.org/review/892
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-31 18:44:26 +00:00
AndersBroman 6a3394eefa Inlining wmem_strbuf_grow seems to give better performance.
Change-Id: I80f3d42fb01461af97984b463a6e8b8217eed552
Reviewed-on: https://code.wireshark.org/review/888
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 15:20:08 +00:00
Evan Huus 7df883954e Splay tree implementation for wmem
This is a tree implementation intended to replace the current red-black tree in
wmem_tree (which was inherited from emem), assuming there are no regressions.
Splay trees bubble recently accessed keys to the top, and as such have a number
of very nice properties: https://en.wikipedia.org/wiki/Splay_tree

This implementation is a variant known as "independent semi-splaying", which has
better practical performance. It should do about as well as the red-black tree
for random insertions and accesses, but somewhat better for patterned accesses
(such as accessing each key in order, or accessing certain keys very
frequently).

There are a few other changes relative to the red-black tree implementation that
are worth mentioning:
 - Instead of requiring complex keys to be split into guint32 chunks and doing
   this weird trick with sub-trees, I let the keys be arbitrary pointers and
   allowed the user to specify an arbitrary comparison function. If the function
   is NULL then the pointers are compared directly for the simple integer-key
   case.
 - Splay trees do not need to store a red-black colour flag for each node. It is
   also much easier to do without the parent pointer in each node. And due to
   the simpler system for complex keys, I was able to remove the "is_subtree"
   boolean. As such, splay nodes are 12 bytes smaller on 32-bit platforms, and
   16 bytes smaller on a 64-bit platform.

All done in about half the lines of code.

Change-Id: I89fb57e07d2bb7e3197190c7c2597b0c5adcc03b
Reviewed-on: https://code.wireshark.org/review/758
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-29 18:01:55 +00:00
Evan Huus 48fc43baad Implement finalize() method for wmem strbuf.
Change-Id: Ib7a2b0d348b3624f41253e2d0995a4a38a9fe45d
Reviewed-on: https://code.wireshark.org/review/859
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-29 12:11:21 +00:00
AndersBroman 86d65a0758 Introduce wmem_ascii_strdown()
Change-Id: Icdc5a0d5033f3ab709fbf19a33ab26f609d4b1f0
Reviewed-on: https://code.wireshark.org/review/824
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-25 16:10:43 +00:00
Evan Huus 35098d20a2 Fix memory-alignment in the block allocator.
The previous macro gave the correct alignment, but there was one case where it
would add a whole block of unnecessary ALIGN_SIZE bytes. The new one is also
slightly faster to compute.

Benchmark win of about 3%.

Change-Id: I5d8bad0f78dc0e383e14c2c7a951328a06400020
Reviewed-on: https://code.wireshark.org/review/492
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-04 17:09:40 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Evan Huus 01467c294a Remove assertions from block allocator.
It has been extremely well-tested at this point, and is a very hot code path so
the performance gain is measurable (~1-2% on most captures I tried).

Change-Id: I2f5e03d2f348f56e740bf0dfbc83a4fd9cc8c5a9
Reviewed-on: https://code.wireshark.org/review/499
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:18:51 +00:00
Evan Huus 36e68f7b36 From Jim Young via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9613
Don't use "rand" as a variable name, it shadows a global in recent MacOSX
stdlib.h

svn path=/trunk/; revision=54598
2014-01-05 00:47:24 +00:00
Evan Huus 1dfa4e2697 Add wmem_destroy_list, wmem_destroy_queue, wmem_destroy_stack so that those
data-structures can be used with manually managed memory.

svn path=/trunk/; revision=54432
2013-12-24 01:17:41 +00:00
Anders Broman 350a207a22 Try to please the buildbot.
svn path=/trunk/; revision=54281
2013-12-20 06:50:46 +00:00
Anders Broman 5fbfa6c351 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54280
2013-12-20 06:30:13 +00:00
Jakub Zawadzki 2c015bb386 Fix some const/ not const warnings.
svn path=/trunk/; revision=54114
2013-12-15 12:35:00 +00:00
Evan Huus d04079eedc Expose wmem_list_remove_frame to make it efficient to do pop operations as
wmem_list_remove_frame(wmem_list_tail())

svn path=/trunk/; revision=53088
2013-11-05 17:28:19 +00:00
Evan Huus 1f3549168d Don't link explicitly with libwmem, it's already in libwireshark and the symbol
doubling leads to all sorts of very subtle badness (including test failures due
to funny internal assertions because the two wmems have mismatching state).

Make wmem_init and wmem_cleanup PUBLIC instead of LOCAL so that they don't get
stripped and don't cause a link failure when trying to build oids_test (now that
it's not linking with libwmem explicitly). There is possibly a better way to fix
this, but I'm not sure what it is.

svn path=/trunk/; revision=52694
2013-10-19 19:40:02 +00:00