aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-11-12 22:06:00 +0000
committerGuy Harris <guy@alum.mit.edu>2013-11-12 22:06:00 +0000
commit409dd075c6dbd46a0073c87e1de2c47ec8ecccde (patch)
tree6ed6029d1e8de2f109a9dc93559009f6d2c13e2f /epan
parent72f3c258a04d6323699eb9ebca13e53d2cb5b22e (diff)
Replace fvalue_ftype() with a fvalue_type_ftenum() routine that returns
the ftenum_t for the fvalue's ftype, rather than a pointer to the ftype (which isn't all that useful except as a handle, unless you import the internal header). Have fvalue_to_string_repr() return NULL, rather than failing, if the fvalue's ftype has no val_to_string_repr method. This lets us not include the ftypes internal header in ui/cli/tap-diameter-avp.c. svn path=/trunk/; revision=53290
Diffstat (limited to 'epan')
-rw-r--r--epan/dfilter/dfunctions.c4
-rw-r--r--epan/ftypes/ftypes.c11
-rw-r--r--epan/ftypes/ftypes.h4
3 files changed, 11 insertions, 8 deletions
diff --git a/epan/dfilter/dfunctions.c b/epan/dfilter/dfunctions.c
index b99b9bb43e..148127b53d 100644
--- a/epan/dfilter/dfunctions.c
+++ b/epan/dfilter/dfunctions.c
@@ -63,7 +63,7 @@ string_walk(GList* arg1list, GList **retval, gchar(*conv_func)(gchar))
arg1 = arg1list;
while (arg1) {
arg_fvalue = (fvalue_t *)arg1->data;
- switch (fvalue_ftype(arg_fvalue)->ftype) {
+ switch (fvalue_type_ftenum(arg_fvalue)) {
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
@@ -114,7 +114,7 @@ df_func_len(GList* arg1list, GList *arg2junk _U_, GList **retval)
arg1 = arg1list;
while (arg1) {
arg_fvalue = (fvalue_t *)arg1->data;
- switch (fvalue_ftype(arg_fvalue)->ftype) {
+ switch (fvalue_type_ftenum(arg_fvalue)) {
case FT_STRING:
case FT_STRINGZ:
case FT_UINT_STRING:
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c
index a98889d437..a409c9ce1e 100644
--- a/epan/ftypes/ftypes.c
+++ b/epan/ftypes/ftypes.c
@@ -264,10 +264,10 @@ fvalue_from_string(ftenum_t ftype, char *s, LogFunc logfunc)
return NULL;
}
-ftype_t*
-fvalue_ftype(fvalue_t *fv)
+ftenum_t
+fvalue_type_ftenum(fvalue_t *fv)
{
- return fv->ftype;
+ return fv->ftype->ftype;
}
const char*
@@ -296,7 +296,10 @@ fvalue_string_repr_len(fvalue_t *fv, ftrepr_t rtype)
char *
fvalue_to_string_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
{
- g_assert(fv->ftype->val_to_string_repr);
+ if (fv->ftype->val_to_string_repr == NULL) {
+ /* no value-to-string-representation function, so the value cannot be represented */
+ return NULL;
+ }
if (!buf) {
int len;
if ((len = fvalue_string_repr_len(fv, rtype)) >= 0) {
diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h
index 079177dc87..96164f717d 100644
--- a/epan/ftypes/ftypes.h
+++ b/epan/ftypes/ftypes.h
@@ -235,8 +235,8 @@ fvalue_string_repr_len(fvalue_t *fv, ftrepr_t rtype);
WS_DLL_PUBLIC char *
fvalue_to_string_repr(fvalue_t *fv, ftrepr_t rtype, char *buf);
-ftype_t*
-fvalue_ftype(fvalue_t *fv);
+WS_DLL_PUBLIC ftenum_t
+fvalue_type_ftenum(fvalue_t *fv);
const char*
fvalue_type_name(fvalue_t *fv);