aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ansi_637.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-06-26 19:56:52 +0000
committerGuy Harris <guy@alum.mit.edu>2005-06-26 19:56:52 +0000
commitab797734ddebd50f40deae437f27392ca4651c92 (patch)
tree82a95df0652f9df59634fd7a7f8dd36026fa4ea7 /epan/dissectors/packet-ansi_637.c
parent2b07720c2fde93c0ee91e88969e76493ee7f86de (diff)
Get rid of the private "my_match_strval()" routine in many dissectors;
add a "match_strval_idx()" routine that does the same thing, and have "match_strval()" call it. Make those routines, and "val_to_str()", return a "const" pointer. Update dissectors as necessary to squelch compiler warnings produced by that. Use "val_to_str()" rather than using "match_strval()" and then, if the result is null, substituting a specific string. Clean up some other "match_strval()"/"val_to_str()" usages. Add a null pointer check in the NDPS dissector's "attribute_value()" routine, as it's not clear that "global_attribute_name" won't be null at that point. Make some global variables in the AFS4INT dissector local. Make some routines not used outside the module they're in static. Make some tables "static const". Clean up white space. Fix Gerald's address in some files. svn path=/trunk/; revision=14786
Diffstat (limited to 'epan/dissectors/packet-ansi_637.c')
-rw-r--r--epan/dissectors/packet-ansi_637.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/epan/dissectors/packet-ansi_637.c b/epan/dissectors/packet-ansi_637.c
index 142832c742..0f2291744f 100644
--- a/epan/dissectors/packet-ansi_637.c
+++ b/epan/dissectors/packet-ansi_637.c
@@ -275,27 +275,6 @@ decode_7_bits(tvbuff_t *tvb, guint32 *offset, guint8 num_fields, guint8 *last_oc
*last_oct = (bit == 1) ? oct : oct2;
}
-static const gchar *
-my_match_strval(guint32 val, const value_string *vs, gint *idx)
-{
- gint i = 0;
-
- while (vs[i].strptr)
- {
- if (vs[i].value == val)
- {
- *idx = i;
- return(vs[i].strptr);
- }
-
- i++;
- }
-
- *idx = -1;
- return(NULL);
-}
-
-
/* PARAM FUNCTIONS */
#define EXTRANEOUS_DATA_CHECK(edc_len, edc_max_len) \
@@ -925,7 +904,7 @@ static void
trans_param_tele_id(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset, gchar *add_string)
{
guint32 value;
- gchar *str = NULL;
+ const gchar *str = NULL;
EXACT_DATA_CHECK(len, 2);
@@ -949,7 +928,7 @@ static void
trans_param_srvc_cat(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset, gchar *add_string)
{
guint32 value;
- gchar *str = NULL;
+ const gchar *str = NULL;
EXACT_DATA_CHECK(len, 2);
@@ -1498,7 +1477,7 @@ dissect_ansi_637_tele_param(tvbuff_t *tvb, proto_tree *tree, guint32 *offset)
curr_offset = *offset;
oct = tvb_get_guint8(tvb, curr_offset);
- str = my_match_strval((guint32) oct, ansi_tele_param_strings, &idx);
+ str = match_strval_idx((guint32) oct, ansi_tele_param_strings, &idx);
if (NULL == str)
{
@@ -1556,7 +1535,7 @@ dissect_ansi_637_tele_message(tvbuff_t *tvb, proto_tree *ansi_637_tree)
guint32 curr_offset;
guint32 msg_id;
guint32 msg_type;
- gchar *str = NULL;
+ const gchar *str = NULL;
proto_item *item;
proto_tree *subtree;
@@ -1625,7 +1604,7 @@ dissect_ansi_637_tele(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ansi_637_item;
proto_tree *ansi_637_tree = NULL;
- gchar *str = NULL;
+ const gchar *str = NULL;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
@@ -1673,7 +1652,7 @@ dissect_ansi_637_trans_param(tvbuff_t *tvb, proto_tree *tree, guint32 *offset)
curr_offset = *offset;
oct = tvb_get_guint8(tvb, curr_offset);
- str = my_match_strval((guint32) oct, ansi_trans_param_strings, &idx);
+ str = match_strval_idx((guint32) oct, ansi_trans_param_strings, &idx);
if (NULL == str)
{
@@ -1757,7 +1736,7 @@ dissect_ansi_637_trans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
oct = tvb_get_guint8(tvb, 0);
- str = my_match_strval(oct, ansi_trans_msg_type_strings, &idx);
+ str = match_strval_idx(oct, ansi_trans_msg_type_strings, &idx);
if (NULL == str)
{