diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-11-12 22:06:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-11-12 22:06:00 +0000 |
commit | 409dd075c6dbd46a0073c87e1de2c47ec8ecccde (patch) | |
tree | 6ed6029d1e8de2f109a9dc93559009f6d2c13e2f /epan/ftypes | |
parent | 72f3c258a04d6323699eb9ebca13e53d2cb5b22e (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/ftypes')
-rw-r--r-- | epan/ftypes/ftypes.c | 11 | ||||
-rw-r--r-- | epan/ftypes/ftypes.h | 4 |
2 files changed, 9 insertions, 6 deletions
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); |