Commit Graph

15 Commits

Author SHA1 Message Date
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
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 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
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
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 777f060f01 Trivial code style: use wmem_new in a few places, and remove extraneous
whitespace.

svn path=/trunk/; revision=50401
2013-07-06 04:08:07 +00:00
Evan Huus 5deac1e6e1 Wmem string-buffer improvements:
- better tests
- fix a bug caught by the better tests
- implement append_c and append_unichar, with tests

Wmem string-buffers now have feature parity with their emem equivalents, so
remove them from the TODO list.

svn path=/trunk/; revision=49060
2013-04-26 21:30:24 +00:00
Evan Huus 2616e09140 Add truncate function to wmem strbuf.
svn path=/trunk/; revision=49010
2013-04-24 00:11:57 +00:00
Evan Huus 2b9db8a7d4 Add wmem string-buffer tests and fix associated bugs.
svn path=/trunk/; revision=48957
2013-04-21 23:19:37 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Evan Huus 8c8533e0dd Use the new realloc API when growing a string-buffer.
svn path=/trunk/; revision=47571
2013-02-08 17:09:18 +00:00
Evan Huus 8331c0e495 Add a cast to pacify MSVC.
svn path=/trunk/; revision=46850
2012-12-29 21:34:57 +00:00
Evan Huus 563d64862a Implement wmem_strbuf_append_printf.
svn path=/trunk/; revision=46846
2012-12-29 20:37:53 +00:00
Evan Huus 03af5455c7 Make the wmem string-buffer marginally useful but providing some accessors so
it's not a write-only data structure.

svn path=/trunk/; revision=46605
2012-12-19 00:51:48 +00:00
Evan Huus 92cfec56b8 Basic wmem string-buffer. Not yet feature-equivalent to the emem version.
svn path=/trunk/; revision=46540
2012-12-15 00:46:36 +00:00