Commit Graph

15 Commits

Author SHA1 Message Date
Peter Wu 3d1e3023d2 wmem: make wmem_strsplit behave more like g_strsplit
In the past "g_strsplit" users were converted to use "wmem_strsplit" to
avoid memory leaks when dissection fails. The semantics were slightly
different though. When the DNS dissector tried to split the string "."
using delimiter ".", it would previously (unexpectedly) receive an empty
vector (and crash). Now it will receive a vector with one element.

Additionally, suggest that users of wmem_strsplit with a NULL allocator
use g_strsplit instead, otherwise it will leak the elements.

Bug: 14980
Change-Id: I408dfdb0ffa9e24ccdba69c8ee095abea72f6feb
Reviewed-on: https://code.wireshark.org/review/28724
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-17 09:03:22 +00:00
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
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
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
Evan Huus d487bba75f Add wmem_alloc_array, wmem_strsplit, wmem_strconcat.
svn path=/trunk/; revision=50017
2013-06-18 21:25:37 +00:00
Evan Huus a9c35aa4b6 First batch of doxygen for wmem. Remove some things from README.wmem now that
they're in doxygen instead.

svn path=/trunk/; revision=49583
2013-05-26 02:40:40 +00:00
Evan Huus 7d2c6f3000 Annotate wmem functions for better compiler warnings and optimization.
svn path=/trunk/; revision=49041
2013-04-25 22:54:36 +00:00
Evan Huus e7de549c8c Add the appropriate new WS_DLL_* declarations to the wmem API.
svn path=/trunk/; revision=48220
2013-03-09 20:25:44 +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
Guy Harris 1340194a62 wmem_allocator_t is defined in wmem_core.h; redefining it elsewhere will
cause errors.

svn path=/trunk/; revision=45771
2012-10-24 18:38:55 +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