aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes/ftypes.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2003-06-11 21:24:54 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2003-06-11 21:24:54 +0000
commit6823d063ee7093fed3e512738005f928aac9e88f (patch)
tree92253e24d0301a29611b54335a976822da8c47f4 /epan/ftypes/ftypes.c
parent03731079cada7249deea33e72d626599b6213ebb (diff)
Expand the ability of fvalue_to_string_repr, and modify more FT_* types
to provide that method. svn path=/trunk/; revision=7849
Diffstat (limited to 'epan/ftypes/ftypes.c')
-rw-r--r--epan/ftypes/ftypes.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c
index a0e0804d57..fb07b1a738 100644
--- a/epan/ftypes/ftypes.c
+++ b/epan/ftypes/ftypes.c
@@ -1,5 +1,5 @@
/*
- * $Id: ftypes.c,v 1.8 2003/02/08 04:22:37 gram Exp $
+ * $Id: ftypes.c,v 1.9 2003/06/11 21:24:54 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -25,6 +25,7 @@
#endif
#include <ftypes-int.h>
+#include <glib.h>
/* Keep track of ftype_t's via their ftenum number */
static ftype_t* type_list[FT_NUM_TYPES];
@@ -272,17 +273,21 @@ fvalue_length(fvalue_t *fv)
}
int
-fvalue_string_repr_len(fvalue_t *fv)
+fvalue_string_repr_len(fvalue_t *fv, ftrepr_t rtype)
{
g_assert(fv->ftype->len_string_repr);
- return fv->ftype->len_string_repr(fv);
+ return fv->ftype->len_string_repr(fv, rtype);
}
char *
-fvalue_to_string_repr(fvalue_t *fv)
+fvalue_to_string_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
{
g_assert(fv->ftype->val_to_string_repr);
- return fv->ftype->val_to_string_repr(fv);
+ if (!buf) {
+ buf = g_malloc0(fvalue_string_repr_len(fv, rtype) + 1);
+ }
+ fv->ftype->val_to_string_repr(fv, rtype, buf);
+ return buf;
}
typedef struct {