Remove proto_item_append_string.

It requires some "extra work" to get it to work properly.  Despite
documenting it, some previous use cases didn't do the extra work.
Let's just see how we get by without it.

Change-Id: I31dba1d5038d793085f6c9e4b4a6eda574e86872
Reviewed-on: https://code.wireshark.org/review/15610
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Michael Mann 2016-05-29 15:44:54 -04:00 committed by Anders Broman
parent 0add74fcc9
commit 33414fe175
3 changed files with 0 additions and 67 deletions

View File

@ -986,7 +986,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
proto_is_protocol_enabled@Base 1.9.1
proto_is_frame_protocol@Base 1.99.1
proto_item_add_subtree@Base 1.9.1
proto_item_append_string@Base 1.9.1
proto_item_append_text@Base 1.9.1
proto_item_fill_label@Base 1.9.1
proto_item_get_len@Base 1.9.1

View File

@ -3531,52 +3531,6 @@ proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
return pi;
}
/* Appends string data to a FT_STRING, FT_STRINGZ, or FT_STRINGZPAD,
* allowing progressive field info update instead of only updating the
* representation as does proto_item_append_text()
*/
/*
* NOTE: this function will break with the TRY_TO_FAKE_THIS_ITEM()
* speed optimization.
* Currently only a few dissectors use this function so it is not
* that bad but try to avoid using this one if possible.
* IF you must use this function you MUST also disable the
* TRY_TO_FAKE_THIS_ITEM() optimization for the proto_item you'll be
* appending to with proto_item_append_string().
* Do that by faking that the tree is visible by calling
* proto_tree_set_visible(tree, TRUE) (see packet-frame.c)
* BEFORE you create the item you are later going to use
* proto_item_append_string() on.
*/
void
proto_item_append_string(proto_item *pi, const char *str)
{
field_info *fi;
header_field_info *hfinfo;
const gchar *old_str, *new_str;
if (!pi)
return;
if (!*str)
return;
fi = PITEM_FINFO(pi);
DISSECTOR_ASSERT_HINT(fi, "proto_tree_set_visible(tree, TRUE) should have been called previously");
hfinfo = fi->hfinfo;
if (hfinfo->type == FT_PROTOCOL) {
/* TRY_TO_FAKE_THIS_ITEM() speed optimization: silently skip */
return;
}
DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo);
old_str = (guint8 *)fvalue_get(&fi->value);
if (old_str && old_str[0])
new_str = wmem_strconcat(wmem_packet_scope(), old_str, str, NULL);
else
new_str = str;
fvalue_set_string(&fi->value, new_str);
}
/* Set the FT_STRING value */
static void
proto_tree_set_string(field_info *fi, const char* value)

View File

@ -2066,26 +2066,6 @@ proto_tree_add_debug_text(proto_tree *tree, const char *format,
...) G_GNUC_PRINTF(2,3);
/** Append a string to a protocol item.<br>
NOTE: this function will break with the TRY_TO_FAKE_THIS_ITEM()
speed optimization.
Currently only a few dissectors use this function so it is not
that bad but try to avoid using this one if possible.
IF you must use this function you MUST also disable the
TRY_TO_FAKE_THIS_ITEM() optimization for the proto_item you'll be
appending to with proto_item_append_string().
Do that by faking that the tree is visible by calling
proto_tree_set_visible(tree, TRUE) (see packet-frame.c)
BEFORE you create the item you are later going to use
proto_item_append_string() on.
@param pi the item to append the string to
@param str the string to append */
WS_DLL_PUBLIC void
proto_item_append_string(proto_item *pi, const char *str);
/** Fill given label_str with string representation of field
@param fi the item to get the info from
@param label_str the string to fill