From 729ea56b46b1c9faca58108b26723d1ddc986a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Fri, 25 Nov 2022 18:32:41 +0000 Subject: wmem: Remove wmem_strbuf_new_label() Only dissectors are using this function and there is no use case, as far as I know, that requires its use. Any limitation of length is imposed transparently by the UI backend. This function is problematic because it is not Unicode aware and will truncate a string on an arbitrary byte boundary for multibyte strings. Replace its use with a normal strbuf without a length limite and remove the function because it is not useful and the ITEM_LABEL_LENGTH parameter does not belong in wmem anyway. --- wsutil/wmem/wmem_strbuf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wsutil') diff --git a/wsutil/wmem/wmem_strbuf.h b/wsutil/wmem/wmem_strbuf.h index bc52026986..f063b4b341 100644 --- a/wsutil/wmem/wmem_strbuf.h +++ b/wsutil/wmem/wmem_strbuf.h @@ -58,14 +58,14 @@ wmem_strbuf_sized_new(wmem_allocator_t *allocator, size_t alloc_size, size_t max_size) G_GNUC_MALLOC; -#define wmem_strbuf_new_label(ALLOCATOR) \ - wmem_strbuf_sized_new((ALLOCATOR), 0, ITEM_LABEL_LENGTH) - WS_DLL_PUBLIC wmem_strbuf_t * wmem_strbuf_new(wmem_allocator_t *allocator, const gchar *str) G_GNUC_MALLOC; +#define wmem_strbuf_create(allocator) \ + wmem_strbuf_new(allocator, "") + WS_DLL_PUBLIC wmem_strbuf_t * wmem_strbuf_new_len(wmem_allocator_t *allocator, const gchar *str, size_t len) -- cgit v1.2.3