Commit Graph

267 Commits

Author SHA1 Message Date
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