diff options
author | João Valverde <j@v6e.pt> | 2021-11-11 00:54:00 +0000 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-11-11 03:15:31 +0000 |
commit | 1a32a75a621086349f8eb30693bab5dec14b19f3 (patch) | |
tree | b6f281e91fd5401befffdd8e86377b7d681d46f9 /epan/dfilter | |
parent | 37f1cf1a925d67ce495ba44b77a08904ca1ee21b (diff) |
ftypes: Internal headers need to be internal
The header ftypes-int.h should not be used outside of epan/ftypes
because it is a private header.
The functions fvalue_free() and fvalue_cleanup() need not and should
not be macros either.
Diffstat (limited to 'epan/dfilter')
-rw-r--r-- | epan/dfilter/dfilter-macro.c | 17 | ||||
-rw-r--r-- | epan/dfilter/dfunctions.c | 1 | ||||
-rw-r--r-- | epan/dfilter/dfvm.c | 6 | ||||
-rw-r--r-- | epan/dfilter/semcheck.c | 2 | ||||
-rw-r--r-- | epan/dfilter/sttype-pointer.c | 12 |
5 files changed, 20 insertions, 18 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c index bf1bc3c154..33c0c0e637 100644 --- a/epan/dfilter/dfilter-macro.c +++ b/epan/dfilter/dfilter-macro.c @@ -18,7 +18,7 @@ #include "dfilter-int.h" #include "dfilter.h" #include "dfilter-macro.h" -#include <ftypes/ftypes-int.h> +#include <ftypes/ftypes.h> #include <epan/uat-int.h> #include <epan/proto.h> #include <wsutil/glib-compat.h> @@ -50,7 +50,7 @@ static gboolean fvt_cache_cb(proto_node * node, gpointer data _U_) { if ((e = (fvt_cache_entry_t*)g_hash_table_lookup(fvt_cache,finfo->hfinfo->abbrev))) { e->usable = FALSE; - } else if (finfo->value.ftype->val_to_string_repr) { + } else { switch (finfo->hfinfo->type) { case FT_NONE: case FT_PROTOCOL: @@ -58,11 +58,14 @@ static gboolean fvt_cache_cb(proto_node * node, gpointer data _U_) { default: break; } - e = g_new(fvt_cache_entry_t,1); - e->name = finfo->hfinfo->abbrev; - e->repr = fvalue_to_string_repr(NULL, &(finfo->value), FTREPR_DFILTER, finfo->hfinfo->display); - e->usable = TRUE; - g_hash_table_insert(fvt_cache,(void*)finfo->hfinfo->abbrev,e); + char *repr = fvalue_to_string_repr(NULL, &(finfo->value), FTREPR_DFILTER, finfo->hfinfo->display); + if (repr) { + e = g_new(fvt_cache_entry_t,1); + e->name = finfo->hfinfo->abbrev; + e->repr = repr; + e->usable = TRUE; + g_hash_table_insert(fvt_cache,(void*)finfo->hfinfo->abbrev,e); + } } return FALSE; } diff --git a/epan/dfilter/dfunctions.c b/epan/dfilter/dfunctions.c index dd50f27b5b..69f5ec576f 100644 --- a/epan/dfilter/dfunctions.c +++ b/epan/dfilter/dfunctions.c @@ -15,7 +15,6 @@ #include <string.h> -#include <ftypes/ftypes-int.h> #include <ftypes/ftypes.h> #include <epan/exceptions.h> #include <wsutil/ws_assert.h> diff --git a/epan/dfilter/dfvm.c b/epan/dfilter/dfvm.c index 67a83a016c..c573f350ee 100644 --- a/epan/dfilter/dfvm.c +++ b/epan/dfilter/dfvm.c @@ -10,7 +10,7 @@ #include "dfvm.h" -#include <ftypes/ftypes-int.h> +#include <ftypes/ftypes.h> #include <wsutil/ws_assert.h> dfvm_insn_t* @@ -32,7 +32,7 @@ dfvm_value_free(dfvm_value_t *v) { switch (v->type) { case FVALUE: - FVALUE_FREE(v->value.fvalue); + fvalue_free(v->value.fvalue); break; case DRANGE: drange_free(v->value.drange); @@ -504,7 +504,7 @@ static void free_owned_register(gpointer data, gpointer user_data _U_) { fvalue_t *value = (fvalue_t *)data; - FVALUE_FREE(value); + fvalue_free(value); } /* Clear registers that were populated during evaluation (leaving constants diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index 252042aa4a..fcca66cafe 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -26,7 +26,7 @@ #include <wsutil/ws_assert.h> #include <wsutil/wslog.h> -#include <ftypes/ftypes-int.h> +#include <ftypes/ftypes.h> #define FAIL(dfw, ...) \ diff --git a/epan/dfilter/sttype-pointer.c b/epan/dfilter/sttype-pointer.c index 4f7e02e9df..184831c74f 100644 --- a/epan/dfilter/sttype-pointer.c +++ b/epan/dfilter/sttype-pointer.c @@ -10,17 +10,17 @@ #include "config.h" #include "ftypes/ftypes.h" -#include "ftypes/ftypes-int.h" #include "syntax-tree.h" +#include <epan/proto.h> // For BASE_NONE static void -fvalue_free(gpointer value) +sttype_fvalue_free(gpointer value) { fvalue_t *fvalue = value; /* If the data was not claimed with stnode_steal_data(), free it. */ if (fvalue) { - FVALUE_FREE(fvalue); + fvalue_free(fvalue); } } @@ -41,7 +41,7 @@ pcre_free(gpointer value) } static char * -fvalue_tostr(const void *data, gboolean pretty) +sttype_fvalue_tostr(const void *data, gboolean pretty) { const fvalue_t *fvalue = data; @@ -87,9 +87,9 @@ sttype_register_pointer(void) STTYPE_FVALUE, "FVALUE", NULL, - fvalue_free, + sttype_fvalue_free, NULL, - fvalue_tostr + sttype_fvalue_tostr }; static sttype_t pcre_type = { STTYPE_PCRE, |