aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2007-10-11 19:40:58 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2007-10-11 19:40:58 +0000
commitc1484a08dfaa778cc070cad795fbc76b60d3417b (patch)
tree37659dd759c974b9f651d286ec8c96c7ba8404e9
parentd0e34ab8c359963a1e428d2ea8bd1ea69a20d620 (diff)
Allow for dynamic value string array selection.
svn path=/trunk/; revision=23149
-rw-r--r--epan/value_string.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/epan/value_string.c b/epan/value_string.c
index 49d44d5b29..a6c39ee7d7 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -56,16 +56,18 @@ const gchar*
match_strval_idx(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);
+ if(vs) {
+ while (vs[i].strptr) {
+ if (vs[i].value == val) {
+ *idx = i;
+ return(vs[i].strptr);
+ }
+ i++;
}
- i++;
}
*idx = -1;
- return(NULL);
+ return NULL;
}
/* Like match_strval_idx(), but doesn't return the index. */
@@ -137,16 +139,18 @@ const gchar *match_strrval_idx(guint32 val, const range_string *rs, gint *idx)
{
gint i = 0;
- while(rs[i].strptr) {
- if( (val >= rs[i].value_min) && (val <= rs[i].value_max) ) {
- *idx = i;
- return (rs[i].strptr);
+ if(rs) {
+ while(rs[i].strptr) {
+ if( (val >= rs[i].value_min) && (val <= rs[i].value_max) ) {
+ *idx = i;
+ return (rs[i].strptr);
+ }
+ i++;
}
- i++;
}
*idx = -1;
- return (NULL);
+ return NULL;
}
/* Like match_strrval_idx(), but doesn't return the index. */