Commit Graph

17 Commits

Author SHA1 Message Date
Craig Jackson d1ce1baf63 WMEM: Add strjoin routines.
Add wmem versions corresponding to g_strjoin() and g_strjoinv().

Modify packet-rtps.c to use wmem routines_ where it is now using g_ routines causing mallocs.

Change-Id: I92c890a8b8f29a973e103676d8e5a681ee5abd50
Reviewed-on: https://code.wireshark.org/review/25764
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-13 06:18:09 +00:00
Dario Lombardo fc082fa2a9 wmem: use SPDX identifiers.
Change-Id: Iad9a7a8a26bc6a7189a4578dfbcec1c2b3cc376e
Reviewed-on: https://code.wireshark.org/review/25692
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:02 +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
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
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
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
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 f4e5a62325 Clean up wmem_strsplit to remove a bunch of weird switch statements and
unnecessary continue statements. Should fix the coverity issues Joerg pointed
out as well.

svn path=/trunk/; revision=50033
2013-06-19 06:48:08 +00:00
Evan Huus d487bba75f Add wmem_alloc_array, wmem_strsplit, wmem_strconcat.
svn path=/trunk/; revision=50017
2013-06-18 21:25: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
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Evan Huus f4a786638b Add strdup_printf and strdup_vprintf to the wmem string utilities.
svn path=/trunk/; revision=46177
2012-11-25 14:16:50 +00:00
Evan Huus 82501433e3 Use const in wmem where possible.
svn path=/trunk/; revision=45976
2012-11-08 23:18:26 +00:00
Evan Huus 84cc3daa3b Basic skeleton for wmem.
https://www.wireshark.org/lists/wireshark-dev/201210/msg00178.html

svn path=/trunk/; revision=45746
2012-10-24 02:04:40 +00:00