aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-02-02 19:58:29 -0500
committerMichael Mann <mmann78@netscape.net>2015-02-03 13:03:32 +0000
commitb63599762468e4cf1783419a5556377604d344bb (patch)
treef77790ecea3d83e6552dcd68420ab5035d8adede /epan
parente9429732ff91cbbbaead63b643870da91ef415bd (diff)
Convert val_to_str_ext -> val_to_str_ext_wmem for calls that don't have valid packet scope (GUI).
val_to_str_ext now officially uses wmem_packet_scope(). Removed const from val_to_str[_ext]_wmem return value since it's not really constant. Created utility functions in qt_ui_utils.h to help with the new memory management for its GUI. Change-Id: Idf2ce4a4ce78d628b2269ad23a3a48fbfc9c077c Reviewed-on: https://code.wireshark.org/review/6926 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r--epan/value_string.c10
-rw-r--r--epan/value_string.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/epan/value_string.c b/epan/value_string.c
index e4879da69e..d5b8b64618 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -50,7 +50,7 @@ val_to_str(const guint32 val, const value_string *vs, const char *fmt)
return ep_strdup_printf(fmt, val);
}
-const gchar *
+gchar *
val_to_str_wmem(wmem_allocator_t *scope, const guint32 val, const value_string *vs, const char *fmt)
{
const gchar *ret;
@@ -59,7 +59,7 @@ val_to_str_wmem(wmem_allocator_t *scope, const guint32 val, const value_string *
ret = try_val_to_str(val, vs);
if (ret != NULL)
- return ret;
+ return wmem_strdup(scope, ret);
return wmem_strdup_printf(scope, fmt, val);
}
@@ -326,10 +326,10 @@ val_to_str_ext(const guint32 val, value_string_ext *vse, const char *fmt)
if (ret != NULL)
return ret;
- return ep_strdup_printf(fmt, val);
+ return wmem_strdup_printf(wmem_packet_scope(), fmt, val);
}
-const gchar *
+gchar *
val_to_str_ext_wmem(wmem_allocator_t *scope, const guint32 val, value_string_ext *vse, const char *fmt)
{
const gchar *ret;
@@ -338,7 +338,7 @@ val_to_str_ext_wmem(wmem_allocator_t *scope, const guint32 val, value_string_ext
ret = try_val_to_str_ext(val, vse);
if (ret != NULL)
- return ret;
+ return wmem_strdup(scope, ret);
return wmem_strdup_printf(scope, fmt, val);
}
diff --git a/epan/value_string.h b/epan/value_string.h
index 746225a4a7..44d22cacc9 100644
--- a/epan/value_string.h
+++ b/epan/value_string.h
@@ -118,7 +118,7 @@ val_to_str(const guint32 val, const value_string *vs, const char *fmt)
G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
-const gchar *
+gchar *
val_to_str_wmem(wmem_allocator_t *scope, const guint32 val, const value_string *vs, const char *fmt)
G_GNUC_PRINTF(4, 0);
@@ -205,7 +205,7 @@ val_to_str_ext(const guint32 val, value_string_ext *vse, const char *fmt)
G_GNUC_PRINTF(3, 0);
WS_DLL_PUBLIC
-const gchar *
+gchar *
val_to_str_ext_wmem(wmem_allocator_t *scope, const guint32 val, value_string_ext *vse, const char *fmt)
G_GNUC_PRINTF(4, 0);