aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 02fefbeb56..60f5fe7e42 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -83,20 +83,6 @@ wrs_count_bitshift(guint32 bitmask)
-#if GLIB_MAJOR_VERSION < 2
-static void *discard_const(const void *const_ptr)
-{
- union {
- const void *const_ptr;
- void *ptr;
- } stupid_const;
-
- stupid_const.const_ptr = const_ptr;
-
- return stupid_const.ptr;
-}
-#endif
-
#define cVALS(x) (const value_string*)(x)
#if 1
@@ -303,12 +289,10 @@ gpa_hfinfo_t gpa_hfinfo;
static GTree *gpa_name_tree = NULL;
static header_field_info *same_name_hfinfo;
-#if GLIB_MAJOR_VERSION >= 2
static void save_same_name_hfinfo(gpointer data)
{
same_name_hfinfo = (header_field_info*)data;
}
-#endif
/* Points to the first element of an array of Booleans, indexed by
a subtree item type; that array element is TRUE if subtrees of
@@ -361,11 +345,7 @@ proto_init(void (register_all_protocols)(register_cb cb, gpointer client_data),
gpa_hfinfo.len=0;
gpa_hfinfo.allocated_len=0;
gpa_hfinfo.hfi=NULL;
-#if GLIB_MAJOR_VERSION < 2
- gpa_name_tree = g_tree_new(wrs_strcmp);
-#else
gpa_name_tree = g_tree_new_full(wrs_strcmp_with_data, NULL, NULL, save_same_name_hfinfo);
-#endif
/* Initialize the ftype subsystem */
ftypes_initialize();
@@ -727,11 +707,7 @@ proto_registrar_get_byname(const char *field_name)
DISSECTOR_ASSERT(field_name != NULL);
-#if GLIB_MAJOR_VERSION < 2
- hfinfo = g_tree_lookup(gpa_name_tree, discard_const(field_name));
-#else
hfinfo = g_tree_lookup(gpa_name_tree, field_name);
-#endif
if (hfinfo) return hfinfo;
@@ -744,11 +720,7 @@ proto_registrar_get_byname(const char *field_name)
return NULL;
}
-#if GLIB_MAJOR_VERSION < 2
- return g_tree_lookup(gpa_name_tree, discard_const(field_name));
-#else
return g_tree_lookup(gpa_name_tree, field_name);
-#endif
}
@@ -3848,13 +3820,9 @@ int proto_get_id_by_filter_name(const gchar* filter_name)
GList *list_entry;
protocol_t *protocol;
-#if GLIB_MAJOR_VERSION < 2
- list_entry = g_list_find_custom(protocols, discard_const(filter_name),
- compare_filter_name);
-#else
list_entry = g_list_find_custom(protocols, filter_name,
compare_filter_name);
-#endif
+
if (list_entry == NULL)
return -1;
protocol = list_entry->data;
@@ -4116,11 +4084,9 @@ proto_register_field_init(header_field_info *hfinfo, int parent)
* a byte, and we want to be able to refer to that field
* with one name regardless of whether the packets
* are modulo-8 or modulo-128 packets. */
-#if GLIB_MAJOR_VERSION < 2
- same_name_hfinfo = g_tree_lookup(gpa_name_tree, discard_const(hfinfo->abbrev));
-#else
+
same_name_hfinfo = NULL;
-#endif
+
g_tree_insert(gpa_name_tree, (gpointer) (hfinfo->abbrev), hfinfo);
/* GLIB 2.x - if it is already present
* the previous hfinfo with the same name is saved