diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-01-15 01:05:03 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-01-15 01:05:03 +0000 |
commit | 61867d0b2f80971dc6927c50f61a4d2bb0420cad (patch) | |
tree | a4cfeca9c61d79a3372b925a99cf9606efcce64b /epan/ftypes/ftype-pcre.c | |
parent | 04b18f44c1af4da3c8c089c58bbc9bb2a1362bc1 (diff) |
Eliminate fvalue_set() in favor of routines that take arguments
appropriate for particular FT_ types. This lets us do some more type
checking and lets us use const pointers when appropriate.
Constify a bunch of stuff, and don't cast away constness.
svn path=/trunk/; revision=54811
Diffstat (limited to 'epan/ftypes/ftype-pcre.c')
-rw-r--r-- | epan/ftypes/ftype-pcre.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/epan/ftypes/ftype-pcre.c b/epan/ftypes/ftype-pcre.c index bce9616d7e..ac2d106cd1 100644 --- a/epan/ftypes/ftype-pcre.c +++ b/epan/ftypes/ftype-pcre.c @@ -75,7 +75,7 @@ raw_flag_needed(const gchar *pattern) /* Generate a FT_PCRE from a parsed string pattern. * Uses the specified logfunc() to report errors. */ static gboolean -val_from_string(fvalue_t *fv, char *pattern, LogFunc logfunc) +val_from_string(fvalue_t *fv, const char *pattern, LogFunc logfunc) { GError *regex_error = NULL; GRegexCompileFlags cflags = G_REGEX_OPTIMIZE; @@ -113,7 +113,7 @@ val_from_string(fvalue_t *fv, char *pattern, LogFunc logfunc) /* Generate a FT_PCRE from an unparsed string pattern. * Uses the specified logfunc() to report errors. */ static gboolean -val_from_unparsed(fvalue_t *fv, char *pattern, gboolean allow_partial_value _U_, LogFunc logfunc) +val_from_unparsed(fvalue_t *fv, const char *pattern, gboolean allow_partial_value _U_, LogFunc logfunc) { g_assert(! allow_partial_value); @@ -137,13 +137,12 @@ gregex_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf) /* BEHOLD - value contains the string representation of the regular expression, * and we want to store the compiled PCRE RE object into the value. */ static void -gregex_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied) +gregex_fvalue_set(fvalue_t *fv, const char *value) { g_assert(value != NULL); /* Free up the old value, if we have one */ gregex_fvalue_free(fv); - g_assert(! already_copied); - val_from_unparsed(fv, (char *)value, FALSE, NULL); + val_from_unparsed(fv, value, FALSE, NULL); } static gpointer @@ -167,7 +166,12 @@ ftype_register_pcre(void) gregex_to_repr, /* val_to_string_repr */ gregex_repr_len, /* len_string_repr */ - gregex_fvalue_set, /* set_value */ + NULL, /* set_value_byte_array */ + NULL, /* set_value_bytes */ + NULL, /* set_value_guid */ + NULL, /* set_value_time */ + gregex_fvalue_set, /* set_value_string */ + NULL, /* set_value_tvbuff */ NULL, /* set_value_uinteger */ NULL, /* set_value_sinteger */ NULL, /* set_value_integer64 */ |