summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-25 17:19:17 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-25 17:19:17 +0000
commit696a79707b4ec36f7f1b6e8cfdcd07871ac85a7e (patch)
tree28fe81d956f0136b021283ac2862a4716682d4c1 /epan
parent35e220513c74aa8715d5e734b1c9f6e490b693d4 (diff)
downloadwireshark-696a79707b4ec36f7f1b6e8cfdcd07871ac85a7e.tar.gz
Optimize proto_item_append_string()
- When old string empty just pass new one (like: frame.protocols) - if not, use ep_strconcat() svn path=/trunk/; revision=50890
Diffstat (limited to 'epan')
-rw-r--r--epan/proto.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 1d2541d452..ae5d632c70 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -2558,7 +2558,7 @@ proto_item_append_string(proto_item *pi, const char *str)
{
field_info *fi;
header_field_info *hfinfo;
- gchar *old_str, *new_str;
+ const gchar *old_str, *new_str;
if (!pi)
return;
@@ -2575,8 +2575,11 @@ proto_item_append_string(proto_item *pi, const char *str)
}
DISSECTOR_ASSERT(hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ);
old_str = (guint8 *)fvalue_get(&fi->value);
- new_str = ep_strdup_printf("%s%s", old_str, str);
- fvalue_set(&fi->value, new_str, FALSE);
+ if (old_str && old_str[0])
+ new_str = ep_strconcat(old_str, str, NULL);
+ else
+ new_str = str;
+ fvalue_set(&fi->value, (gpointer) new_str, FALSE);
}
/* Set the FT_STRING value */