diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-12 17:09:39 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-13 00:10:11 +0000 |
commit | 9769e8af992ef1585492884c794cc95ff9c38cca (patch) | |
tree | 7c3ff006d15fe7efa22a1d6e2bebe58ee5b01a27 | |
parent | 37e45ccba85656a2d33a8c5e1e7d8cdde815badb (diff) |
Use proto_get_finfo_ptr_array() rather than proto_find_finfo().
As the comments say, proto_find_finfo() is slower than
proto_get_finfo_ptr_array(), as it has to scan the entire tree, and,
given that we're priming the tree with the fields we need (which we
*have* to do to *guarantee* that we'll get the fields we want;
requesting that a protocol tree be constructed isn't sufficient, and
asking for a "visible" protocol tree is overkill),
proto_get_finfo_ptr_array() will work.
Change-Id: Ic1e21105a0a89003a3cdd3d7a2e55ac287ddad5e
Reviewed-on: https://code.wireshark.org/review/21068
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | plugins/transum/extractors.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/plugins/transum/extractors.c b/plugins/transum/extractors.c index 178d0d3f27..b07708d69a 100644 --- a/plugins/transum/extractors.c +++ b/plugins/transum/extractors.c @@ -43,7 +43,7 @@ int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t * return -1; } - finfo_array = proto_find_finfo(tree, field_id); + finfo_array = proto_get_finfo_ptr_array(tree, field_id); if (finfo_array == NULL) { return -1; @@ -56,8 +56,6 @@ int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t * result_array[i] = fvalue_get_uinteger(&((field_info*)finfo_array->pdata[i])->value); } - g_ptr_array_free(finfo_array, TRUE); - return 0; } @@ -70,7 +68,7 @@ int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t * return -1; } - finfo_array = proto_find_finfo(tree, field_id); + finfo_array = proto_get_finfo_ptr_array(tree, field_id); if (finfo_array == NULL) { return -1; @@ -83,8 +81,6 @@ int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t * result_array[i] = fvalue_get_uinteger64(&((field_info*)finfo_array->pdata[i])->value); } - g_ptr_array_free(finfo_array, TRUE); - return 0; } @@ -97,7 +93,7 @@ int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t * return -1; } - finfo_array = proto_find_finfo(tree, field_id); + finfo_array = proto_get_finfo_ptr_array(tree, field_id); if (finfo_array == NULL) { return -1; @@ -110,8 +106,6 @@ int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t * result_array[i] = fvalue_get_sinteger64(&((field_info*)finfo_array->pdata[i])->value); } - g_ptr_array_free(finfo_array, TRUE); - return 0; } @@ -124,7 +118,7 @@ int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t return -1; } - finfo_array = proto_find_finfo(tree, field_id); + finfo_array = proto_get_finfo_ptr_array(tree, field_id); if (finfo_array == NULL) { return -1; @@ -142,8 +136,6 @@ int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t result_array[i] = FALSE; } - g_ptr_array_free(finfo_array, TRUE); - return 0; } |