fix GLIB 1.x compatibility
authorkukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 29 Nov 2007 07:48:12 +0000 (07:48 +0000)
committerkukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 29 Nov 2007 07:48:12 +0000 (07:48 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23668 f5534014-38df-0310-8fa8-9805f1628bb7

epan/proto.c

index bce9b590821a5e4f56e75667ca75b492ea627833..7933688fedbde0b84f33543459e0d3a60cb7838f 100644 (file)
@@ -356,7 +356,11 @@ 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();
@@ -3890,9 +3894,13 @@ 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);
-               /* if it is already present 
+               /* GLIB 2.x - if it is already present 
          * the previous hfinfo with the same name is saved 
          * to same_name_hfinfo by value destroy callback */
                if (same_name_hfinfo) {