More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Jul 2011 20:32:19 +0000 (20:32 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Jul 2011 20:32:19 +0000 (20:32 +0000)
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37978 f5534014-38df-0310-8fa8-9805f1628bb7

28 files changed:
doc/README.developer
epan/Makefile.common
epan/dfilter/semcheck.c
epan/dissectors/packet-http.c
epan/dissectors/packet-isakmp.c
epan/dissectors/packet-synphasor.c
epan/emem.h
epan/epan.c
epan/except.h
epan/filesystem.c
epan/ftypes/ftype-bytes.c
epan/ftypes/ftype-pcre.c
epan/ftypes/ftype-string.c
epan/ftypes/ftype-tvbuff.c
epan/ftypes/ftypes-int.h
epan/ftypes/ftypes.h
epan/g_gnuc.h [deleted file]
epan/packet.c
epan/proto.h
epan/reassemble.c
epan/reassemble.h
epan/reassemble_test.c
epan/tvbtest.c
epan/tvbuff.c
epan/tvbuff.h
gtk/expert_comp_table.c
wsutil/file_util.c
wsutil/file_util.h

index df4a3c2d57714b60ec3bd05e9f0635367dac298d..5357332bb50c6578a839faa519c3e74978369611 100644 (file)
@@ -434,10 +434,11 @@ cause a trap, which will, at best, result in the OS slowly performing an
 unaligned access for you, and will, on at least some platforms, cause
 the program to be terminated.
 
-Wireshark supports platforms with GLib 2.4[.x]/GTK+ 2.4[.x] or newer.
-If a Glib/GTK+ mechanism is available only in Glib/GTK+ versions
-newer than 2.4/2.4 then use "#if GTK_CHECK_VERSION(...)" to conditionally
-compile code using that mechanism.
+Wireshark supports platforms with GLib 2.14[.x]/GTK+ 2.12[.x] or newer.
+If a Glib/GTK+ mechanism is available only in Glib/GTK+ versions newer
+than 2.14/2.12 then use "#if GLIB_CHECK_VERSION(...)" or "#if
+GTK_CHECK_VERSION(...)" to conditionally compile code using that
+mechanism.
 
 When different code must be used on UN*X and Win32, use a #if or #ifdef
 that tests _WIN32, not WIN32.  Try to write code portably whenever
index c625e5d86dcf6d3696ea79ba0c770064f8876b9f..63c35ad07662cbd9dfa065cb868315bfc81868cc 100644 (file)
@@ -178,7 +178,6 @@ LIBWIRESHARK_INCLUDES =     \
        gcp.h                   \
        geoip_db.h              \
        golay.h                 \
-       g_gnuc.h                \
        greproto.h              \
        guid-utils.h            \
        h225-persistentdata.h   \
index 8f8cc28f59ca29a7a2c20b9626bb3b288f12f540..194f328e3432f551751fc5acea82f518a446f560 100644 (file)
@@ -1184,13 +1184,7 @@ check_test(stnode_t *st_node)
                        check_relation("contains", TRUE, ftype_can_contains, st_node, st_arg1, st_arg2);
                        break;
                case TEST_OP_MATCHES:
-#if defined(HAVE_LIBPCRE) || GLIB_CHECK_VERSION(2,14,0)
-                       check_relation("matches", TRUE, ftype_can_matches, st_node, st_arg1, st_arg2);
-#else
-                       dfilter_fail("This Wireshark version does not support the \"matches\" operation.");
-                       THROW(TypeError);
-#endif
-                       break;
+                       check_relation("matches", TRUE, ftype_can_matches, st_node, st_arg1, st_arg2);                  break;
 
                default:
                        g_assert_not_reached();
index 94496165e2ab50184f36a0408502634b24e6c3e1..04db9c84b34f8cf9770254e9c853a8ac01b12189 100644 (file)
@@ -2128,15 +2128,7 @@ process_header(tvbuff_t *tvb, int offset, int next_offset,
 
                case HDR_CONTENT_LENGTH:
                        errno = 0;
-#if GLIB_CHECK_VERSION(2,12,0)
                        eh_ptr->content_length = g_ascii_strtoll(value, &p, 10);
-#elif defined(HAVE_STRTOLL)
-                       eh_ptr->content_length = strtoll(value, &p, 10);
-#else
-                       /* Punt and grab a 32-bit value */
-                       eh_ptr->content_length = strtol(value, &p, 10);
-#endif
-
                        up = (guchar *)p;
                        if (eh_ptr->content_length < 0 ||
                            p == value ||
index f8a8b7e4a348595f0e08757d5cf2ca2c9854cb69..e30e0a1ae3bf0660a5aff1132605975659c7c035 100644 (file)
@@ -1519,11 +1519,6 @@ typedef struct decrypt_data {
 } decrypt_data_t;
 
 static GHashTable *isakmp_hash = NULL;
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-static GMemChunk *isakmp_key_data = NULL;
-static GMemChunk *isakmp_decrypt_data = NULL;
-#endif
 
 static ikev1_uat_data_key_t* ikev1_uat_data = NULL;
 static uat_t * ikev1_uat = NULL;
@@ -2686,13 +2681,8 @@ dissect_isakmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     decr = (decrypt_data_t*) g_hash_table_lookup(isakmp_hash, i_cookie);
 
     if (! decr) {
-#if GLIB_CHECK_VERSION(2,10,0)
       ic_key = g_slice_alloc(COOKIE_SIZE);
       decr   = g_slice_alloc(sizeof(decrypt_data_t));
-#else
-      ic_key = g_mem_chunk_alloc(isakmp_key_data);
-      decr   = g_mem_chunk_alloc(isakmp_decrypt_data);
-#endif
       memcpy(ic_key, i_cookie, COOKIE_SIZE);
       memset(decr, 0, sizeof(decrypt_data_t));
       SET_ADDRESS(&decr->initiator, AT_NONE, 0, NULL);
@@ -4710,7 +4700,6 @@ static gint ikev2_key_equal_func(gconstpointer k1, gconstpointer k2) {
 #endif /* HAVE_LIBGCRYPT */
 
 #ifdef HAVE_LIBGCRYPT
-#if GLIB_CHECK_VERSION(2,10,0)
 static gboolean
 free_cookie(gpointer key_arg, gpointer value, gpointer user_data _U_)
 {
@@ -4722,7 +4711,6 @@ free_cookie(gpointer key_arg, gpointer value, gpointer user_data _U_)
   return TRUE;
 }
 #endif
-#endif
 
 static void
 isakmp_init_protocol(void) {
@@ -4736,35 +4724,14 @@ isakmp_init_protocol(void) {
 
 #ifdef HAVE_LIBGCRYPT
   if (isakmp_hash) {
-#if GLIB_CHECK_VERSION(2,10,0)
     g_hash_table_foreach_remove(isakmp_hash, free_cookie, NULL);
-#endif
     g_hash_table_destroy(isakmp_hash);
   }
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-  if (isakmp_key_data)
-    g_mem_chunk_destroy(isakmp_key_data);
-  if (isakmp_decrypt_data)
-    g_mem_chunk_destroy(isakmp_decrypt_data);
-
-  isakmp_key_data = g_mem_chunk_new("isakmp_key_data",
-       COOKIE_SIZE, 5 * COOKIE_SIZE,
-       G_ALLOC_AND_FREE);
-  isakmp_decrypt_data = g_mem_chunk_new("isakmp_decrypt_data",
-       sizeof(decrypt_data_t), 5 * sizeof(decrypt_data_t),
-       G_ALLOC_AND_FREE);
-#endif
   isakmp_hash = g_hash_table_new(isakmp_hash_func, isakmp_equal_func);
 
   for (i = 0; i < num_ikev1_uat_data; i++) {
-#if GLIB_CHECK_VERSION(2,10,0)
       ic_key = g_slice_alloc(COOKIE_SIZE);
       decr   = g_slice_alloc(sizeof(decrypt_data_t));
-#else
-      ic_key = g_mem_chunk_alloc(isakmp_key_data);
-      decr   = g_mem_chunk_alloc(isakmp_decrypt_data);
-#endif
       memcpy(ic_key, ikev1_uat_data[i].icookie, COOKIE_SIZE);
       memset(decr, 0, sizeof(decrypt_data_t));
 
index 7e22d2aa05b6ebc222f9b07735db5fa0d32e7e3a..799b8ea80fd33ef710abf606fcb0a7a3085cbe6d 100644 (file)
@@ -49,10 +49,6 @@ void proto_reg_handoff_synphasor(void);
 static int     proto_synphasor  = -1;
 static GSList *config_frame_list = NULL;
 
-#if ! GLIB_CHECK_VERSION(2,10,0)
-static GMemChunk *frame_chunks   = NULL;
-#endif
-
 /* user preferences */
 static guint global_pref_tcp_port = 4712;
 static guint global_pref_udp_port = 4713;
@@ -319,11 +315,7 @@ static config_frame* config_frame_fast(tvbuff_t *tvb)
        config_frame *frame;
 
        /* get a new frame and initialize it */
-#if GLIB_CHECK_VERSION(2,10,0)
        frame = g_slice_new(config_frame);
-#else
-        frame = g_mem_chunk_alloc(frame_chunks);
-#endif
 
        frame->config_blocks = g_array_new(FALSE, TRUE, sizeof(config_block));
 
@@ -437,11 +429,7 @@ static void config_frame_free(config_frame *frame)
        g_array_free(frame->config_blocks, TRUE);
 
        /* and the config_frame */
-#if GLIB_CHECK_VERSION(2,10,0)
        g_slice_free1(sizeof(config_frame), frame);
-#else
-        g_mem_chunk_free(frame_chunks, frame);
-#endif
 }
 
 /* called every time the user loads a capture file or starts to capture */
@@ -456,15 +444,6 @@ static void synphasor_init(void)
                config_frame_list = NULL;
        }
 
-#if ! GLIB_CHECK_VERSION(2,10,0)
-        if (frame_chunks != NULL) {
-            g_mem_chunk_destroy(frame_chunks);
-        }
-        frame_chunks = g_mem_chunk_new("Frame_Chunks",
-                                       sizeof(config_frame),
-                                       10*(sizeof(config_frame)),
-                                       G_ALLOC_AND_FREE);
-#endif
 }
 
 /* the main dissection routine */
@@ -1419,4 +1398,3 @@ void proto_reg_handoff_synphasor(void)
        dissector_add_uint("udp.port", current_udp_port, synphasor_udp_handle);
        dissector_add_uint("tcp.port", current_tcp_port, synphasor_tcp_handle);
 } /* proto_reg_handoff_synphasor() */
-
index f082106f21a0df29424a403d93c730f0ed8c348b..8989abbf4e2ca0f051ba31a5f9f030505e2db70a 100644 (file)
@@ -26,8 +26,6 @@
 #ifndef __EMEM_H__
 #define __EMEM_H__
 
-#include "g_gnuc.h"
-
 /** @file
  */
 /**  Initialize all the memory allocation pools described below.
index 1eae2f184e35be9f1418960a07d30a04459623eb..fb1c6494e01090d9df90a86048258d699c4834ed 100644 (file)
@@ -101,7 +101,6 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
 #elif defined(HAVE_LIBGCRYPT)
        gcry_check_version(NULL);
 #endif
-       tvbuff_init();
        tap_init();
        prefs_init();
        proto_init(register_all_protocols_func, register_all_handoffs_func,
@@ -129,7 +128,6 @@ epan_cleanup(void)
        prefs_cleanup();
        packet_cleanup();
        oid_resolv_cleanup();
-       tvbuff_cleanup();
 #ifdef HAVE_LIBGNUTLS
        gnutls_global_deinit();
 #endif
index a6c6f191e7bbd282c8a75d71e14a8cf5c73dc859..407be9d83c9063046bf0228fe0b2e73d6fe8494d 100644 (file)
@@ -36,7 +36,6 @@
 #include <setjmp.h>
 #include <stdlib.h>
 #include <assert.h>
-#include <epan/g_gnuc.h>
 
 #define XCEPT_GROUP_ANY        0
 #define XCEPT_CODE_ANY 0
index 1072d91d59aef12d997a0f19c1be5e98e5f5f12d..7ce3786eafb5e61b95ae4de1492f6298fcedb096 100644 (file)
@@ -1270,15 +1270,6 @@ create_persconffile_dir(char **pf_dir_path_return)
   return create_persconffile_profile(persconfprofile, pf_dir_path_return);
 }
 
-#if ! GLIB_CHECK_VERSION(2,14,0)
-static void
-hash_table_get_keys(gpointer key, gpointer value _U_, gpointer user_data)
-{
-       GList **files = ((GList **)user_data);
-       *files = g_list_append (*files, key);
-}
-#endif
-
 int
 copy_persconffile_profile(const char *toname, const char *fromname, gboolean from_global,
                          char **pf_filename_return, char **pf_to_dir_path_return, char **pf_from_dir_path_return)
@@ -1298,13 +1289,7 @@ copy_persconffile_profile(const char *toname, const char *fromname, gboolean fro
                from_dir = g_strdup (get_persconffile_dir(fromname));
        }
 
-#if GLIB_CHECK_VERSION(2,14,0)
        files = g_hash_table_get_keys(profile_files);
-#else
-       files = NULL;
-       g_hash_table_foreach(profile_files, hash_table_get_keys, &files);
-#endif
-
        file = g_list_first(files);
        while (file) {
                filename = (gchar *)file->data;
index c73c21501ebd7868f4a753f1c99737f67b4d47f7..95094810cd7fdc9115b1d8c5a6eaf44359ac0082 100644 (file)
 #include <epan/strutil.h>
 #include <epan/oids.h>
 
-#if defined(HAVE_LIBPCRE) || GLIB_CHECK_VERSION(2,14,0)
-# ifdef HAVE_LIBPCRE
+#ifdef HAVE_LIBPCRE
 # include <pcre.h>
-# endif
-#define CMP_MATCHES cmp_matches
-#else
-#define CMP_MATCHES NULL
 #endif
+#define CMP_MATCHES cmp_matches
 
 static void
 bytes_fvalue_new(fvalue_t *fv)
@@ -506,7 +502,7 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
        }
        return FALSE;
 }
-#elif GLIB_CHECK_VERSION(2,14,0) /* GRegex */
+#else /* GRegex */
 static gboolean
 cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
 {
index 4201dc75c49c58a91f4f19f8bc56d14608757e44..c94f541d26ab9fe471ea9eceea6e479c4e75d0ca 100644 (file)
@@ -39,7 +39,7 @@
 
 #include <pcre.h>
 
-/* Create a pcre_tuple_t object based on the given string pattern */ 
+/* Create a pcre_tuple_t object based on the given string pattern */
 static pcre_tuple_t *
 pcre_tuple_new(const char *value)
 {
@@ -216,7 +216,7 @@ ftype_register_pcre(void)
        ftype_register(FT_PCRE, &pcre_type);
 }
 
-#elif GLIB_CHECK_VERSION(2,14,0) /* No HAVE_LIBPCRE. Try falling back to GRegex. */
+#else /* No HAVE_LIBPCRE. Try falling back to GRegex. */
 
 
 #include <glib.h>
@@ -351,53 +351,8 @@ ftype_register_pcre(void)
        ftype_register(FT_PCRE, &pcre_type);
 }
 
-#else /* No HAVE_LIBPCRE or GRegex */
-
-void
-ftype_register_pcre(void)
-{
-       static ftype_t pcre_type = {
-               FT_PCRE,                /* ftype */
-               "FT_PCRE",                      /* name */
-               "Compiled Perl-Compatible Regular Expression object", /* pretty_name */
-               0,                              /* wire_size */
-               NULL,                           /* new_value */
-               NULL,                           /* free_value */
-               NULL,                           /* val_from_unparsed */
-               NULL,                           /* val_from_string */
-               NULL,                           /* val_to_string_repr */
-               NULL,                           /* len_string_repr */
-
-               NULL,                           /* set_value */
-               NULL,                           /* set_value_uinteger */
-               NULL,                           /* set_value_sinteger */
-               NULL,                           /* set_value_integer64 */
-               NULL,                           /* set_value_floating */
-
-               NULL,                           /* get_value */
-               NULL,                           /* get_value_uinteger */
-               NULL,                           /* get_value_sinteger */
-               NULL,                           /* get_value_integer64 */
-               NULL,                           /* get_value_floating */ 
-
-               NULL,                           /* cmp_eq */
-               NULL,                           /* cmp_ne */
-               NULL,                           /* cmp_gt */
-               NULL,                           /* cmp_ge */
-               NULL,                           /* cmp_lt */
-               NULL,                           /* cmp_le */
-               NULL,                           /* cmp_bitwise_and */
-               NULL,                           /* cmp_contains */
-               NULL,                           /* cmp_matches */
-
-               NULL,                           /* len */
-               NULL,                           /* slice */
-       };
-       ftype_register(FT_PCRE, &pcre_type);
-}
-
 #endif /* HAVE_LIBPCRE */
-            
+
 /*
  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
  *
@@ -410,4 +365,3 @@ ftype_register_pcre(void)
  * vi: set shiftwidth=4 tabstop=4 noexpandtab
  * :indentSize=4:tabSize=4:noTabs=false:
  */
-
index 11ccdf38a7dae0c799a05a61b9aefa389cbb623e..24ec502d9d1bd1737626137946d0ca75f1bd983e 100644 (file)
 #include <ftypes-int.h>
 #include <string.h>
 
-#if defined(HAVE_LIBPCRE) || GLIB_CHECK_VERSION(2,14,0)
-# ifdef HAVE_LIBPCRE
+#ifdef HAVE_LIBPCRE
 # include <pcre.h>
-# endif
-#define CMP_MATCHES cmp_matches
-#else
-#define CMP_MATCHES NULL
 #endif
+#define CMP_MATCHES cmp_matches
 
 #include <ctype.h>
 
@@ -288,7 +284,7 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
        }
        return FALSE;
 }
-#elif GLIB_CHECK_VERSION(2,14,0) /* GRegex */
+#else /* GRegex */
 static gboolean
 cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
 {
index 2b1b44373f47dd72197b122e8930e99fe163c23e..f87c88eed501abe42a4cf70c56373adb13dca902 100644 (file)
 #include <ftypes-int.h>
 #include <string.h>
 
-#if defined(HAVE_LIBPCRE) || GLIB_CHECK_VERSION(2,14,0)
-# ifdef HAVE_LIBPCRE
+#ifdef HAVE_LIBPCRE
 # include <pcre.h>
-# endif
-#define CMP_MATCHES cmp_matches
-#else
-#define CMP_MATCHES NULL
 #endif
+#define CMP_MATCHES cmp_matches
 
 #define tvb_is_private fvalue_gboolean1
 
@@ -253,7 +249,7 @@ cmp_ne(fvalue_t *fv_a, fvalue_t *fv_b)
 
        TRY {
                guint   a_len = tvb_length(a);
-       
+
                if (a_len != tvb_length(b)) {
                        return TRUE;
                }
@@ -277,7 +273,7 @@ cmp_gt(fvalue_t *fv_a, fvalue_t *fv_b)
        TRY {
                guint   a_len = tvb_length(a);
                guint   b_len = tvb_length(b);
+
                if (a_len > b_len) {
                        return TRUE;
                }
@@ -301,7 +297,7 @@ cmp_ge(fvalue_t *fv_a, fvalue_t *fv_b)
 {
        tvbuff_t        *a = fv_a->value.tvb;
        tvbuff_t        *b = fv_b->value.tvb;
-       
+
        TRY {
                guint   a_len = tvb_length(a);
                guint   b_len = tvb_length(b);
@@ -333,7 +329,7 @@ cmp_lt(fvalue_t *fv_a, fvalue_t *fv_b)
        TRY {
                guint   a_len = tvb_length(a);
                guint   b_len = tvb_length(b);
-       
+
                if (a_len < b_len) {
                        return TRUE;
                }
@@ -444,7 +440,7 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
        }
        return FALSE;
 }
-#elif GLIB_CHECK_VERSION(2,14,0) /* GRegex */
+#else /* GRegex */
 static gboolean
 cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
 {
index e84cd42d831209abd47c1becf4119b57b8ad7755..0e8154e4000ba4a24552641d6bb123bbf7bafe03 100644 (file)
@@ -38,8 +38,6 @@ struct _pcre_tuple_t {
     pcre_extra *ex;
     char *error;
 };
-#elif GLIB_CHECK_VERSION(2,14,0) /* No HAVE_LIBPCRE. Try falling back to GRegex. */
-
 #endif /* HAVE_LIBPCRE */
 
 void
index f4ea1ea5bcbf3b5c7d7abd171d3130d0916ac16c..dd95df2720099cd2a1291e3431e6d679107a6c79 100644 (file)
@@ -62,7 +62,7 @@ enum ftenum {
        FT_PCRE,        /* a compiled Perl-Compatible Regular Expression object */
        FT_GUID,        /* GUID, UUID */
        FT_OID,         /* OBJECT IDENTIFIER */
-       FT_EUI64,       
+       FT_EUI64,
        FT_NUM_TYPES /* last item number plus one */
 };
 
@@ -170,7 +170,7 @@ typedef struct _fvalue_t {
                tvbuff_t        *tvb;
 #ifdef HAVE_LIBPCRE
                pcre_tuple_t    *re;
-#elif GLIB_CHECK_VERSION(2,14,0) /* Try falling back to GRegex. */
+#else /* Try falling back to GRegex. */
                GRegex          *re;
 #endif /* HAVE_LIBPCRE */
        } value;
diff --git a/epan/g_gnuc.h b/epan/g_gnuc.h
deleted file mode 100644 (file)
index 3f32e32..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* g_gnuc.h
- * Definitions of macros to conditionally do GCC optimization or code checks
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __G_GNUC_H__
-#define __G_GNUC_H__
-
-/**
- * GLib 2.6 has the ability to enable better optimization of malloc functions.
- * Hide the differences between different glib versions in this G_GNUC_MALLOC macro.
- */
-#if ! GLIB_CHECK_VERSION(2,6,0)
-       #define G_GNUC_MALLOC
-#endif
-
-/* Glib 2.8 and later has this. */
-#if ! GLIB_CHECK_VERSION(2,8,0)
-       #define G_GNUC_NULL_TERMINATED
-#endif
-
-#if ! GLIB_CHECK_VERSION(2,10,0)
-       #define G_GNUC_WARN_UNUSED_RESULT
-#endif
-
-#endif /* g_gnuc.h */
index db33ae7a77b2d19082713e533dd95dded724ce5c..5bc9595c0a8d5ded9bb9b7273159f5bf02b33e44 100644 (file)
@@ -139,12 +139,6 @@ init_dissection(void)
        /* Initialize protocol-specific variables. */
        g_slist_foreach(init_routines, &call_init_routine, NULL);
 
-       /* Initialize the common data structures for fragment reassembly.
-          Must be done *after* calling init routines, as those routines
-          may free up space for fragments, which they find by using the
-          data structures that "reassemble_cleanup()" frees. */
-       reassemble_init();
-
        /* Initialize the stream-handling tables */
        stream_init();
 
@@ -168,12 +162,6 @@ cleanup_dissection(void)
        /* Cleanup protocol-specific variables. */
        g_slist_foreach(init_routines, &call_init_routine, NULL);
 
-       /* Cleanup the common data structures for fragment reassembly.
-          Must be done *after* calling init routines, as those routines
-          may free up space for fragments, which they find by using the
-          data structures that "reassemble_cleanup()" frees. */
-       reassemble_cleanup();
-
        /* Cleanup the stream-handling tables */
        stream_cleanup();
 
index a3abafe976d3393267872ad74df6ac11c78e4b66..0394e213446edb111c84d193a81b50d383b53bb3 100644 (file)
@@ -51,7 +51,6 @@
 #include "tvbuff.h"
 #include "ftypes/ftypes.h"
 #include "register.h"
-#include "g_gnuc.h"
 
 #ifdef __cplusplus
 extern "C" {
index 574a0c2cd04b36fa3bf33a955070d45b42bbeb6d..52ac7b003f28652ff15d48f79414bed5c6ea9664 100644 (file)
@@ -49,14 +49,6 @@ typedef struct _dcerpc_fragment_key {
        e_uuid_t act_id;
 } dcerpc_fragment_key;
 
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-static GMemChunk *fragment_key_chunk = NULL;
-static GMemChunk *fragment_data_chunk = NULL;
-static GMemChunk *dcerpc_fragment_key_chunk = NULL;
-static int fragment_init_count = 200;
-#endif
-
 static void LINK_FRAG(fragment_data *fd_head,fragment_data *fd)
 {
        fragment_data *fd_i;
@@ -74,11 +66,7 @@ static void LINK_FRAG(fragment_data *fd_head,fragment_data *fd)
 static void *fragment_key_copy(const void *k)
 {
        const fragment_key* key = (const fragment_key*) k;
-#if GLIB_CHECK_VERSION(2,10,0)
        fragment_key *new_key = g_slice_new(fragment_key);
-#else
-       fragment_key *new_key = g_mem_chunk_alloc(fragment_key_chunk);
-#endif
 
        COPY_ADDRESS(&new_key->src, &key->src);
        COPY_ADDRESS(&new_key->dst, &key->dst);
@@ -91,11 +79,7 @@ static void *dcerpc_fragment_key_copy(const void *k)
 {
        const dcerpc_fragment_key* key = (const dcerpc_fragment_key*) k;
 
-#if GLIB_CHECK_VERSION(2,10,0)
        dcerpc_fragment_key *new_key = g_slice_new(dcerpc_fragment_key);
-#else
-       dcerpc_fragment_key *new_key = g_mem_chunk_alloc(dcerpc_fragment_key_chunk);
-#endif
 
        COPY_ADDRESS(&new_key->src, &key->src);
        COPY_ADDRESS(&new_key->dst, &key->dst);
@@ -215,46 +199,22 @@ reassembled_hash(gconstpointer k)
  * [or dcerpc_fragment_free_key()] is called (as a consequence of
  * returning TRUE from this function).
  * If mem_chunks are used, free the address data to which the key
- * refers; the the actual key and value structures get freed
- * by "reassemble_cleanup()").
+ * refers.
  */
 static gboolean
 free_all_fragments(gpointer key_arg _U_, gpointer value, gpointer user_data _U_)
 {
        fragment_data *fd_head, *tmp_fd;
 
-#if GLIB_CHECK_VERSION(2,10,0)
        /* If Glib version => 2.10 we do g_hash_table_new_full() and supply a function
         * to free the key and the addresses.
         */
-#else
-       fragment_key *key = key_arg;
-       /*
-        * Grr.  I guess the theory here is that freeing
-        * something sure as heck modifies it, so you
-        * want to ban attempts to free it, but, alas,
-        * if we make the "data" field of an "address"
-        * structure not a "const", the compiler whines if
-        * we try to make it point into the data for a packet,
-        * as that's a "const" array (and should be, as dissectors
-        * shouldn't trash it).
-        *
-        * So we cast the complaint into oblivion, and rely on
-        * the fact that these addresses are known to have had
-        * their data mallocated, i.e. they don't point into,
-        * say, the middle of the data for a packet.
-        */
-       g_free((gpointer)key->src.data);
-       g_free((gpointer)key->dst.data);
-#endif
        for (fd_head = value; fd_head != NULL; fd_head = tmp_fd) {
                tmp_fd=fd_head->next;
 
                if(fd_head->data && !(fd_head->flags&FD_NOT_MALLOCED))
                        g_free(fd_head->data);
-#if GLIB_CHECK_VERSION(2,10,0)
                g_slice_free(fragment_data, fd_head);
-#endif
        }
 
        return TRUE;
@@ -268,11 +228,7 @@ static fragment_data *new_head(const guint32 flags)
        * 'datalen' then we don't have to change the head of the list
        * even if we want to keep it sorted
        */
-#if GLIB_CHECK_VERSION(2,10,0)
        fd_head=g_slice_new0(fragment_data);
-#else
-       fd_head=g_mem_chunk_alloc0(fragment_data_chunk);
-#endif
 
        fd_head->flags=flags;
        return fd_head;
@@ -281,7 +237,6 @@ static fragment_data *new_head(const guint32 flags)
 /*
  * For a reassembled-packet hash table entry, free the fragment data
  * to which the value refers.
- * (The actual value structures get freed by "reassemble_cleanup()".)
  */
 static gboolean
 free_all_reassembled_fragments(gpointer key_arg _U_, gpointer value,
@@ -307,7 +262,6 @@ free_all_reassembled_fragments(gpointer key_arg _U_, gpointer value,
        return TRUE;
 }
 
-#if GLIB_CHECK_VERSION(2,10,0)
 static void
 fragment_free_key(void *ptr)
 {
@@ -339,7 +293,7 @@ dcerpc_fragment_free_key(void *ptr)
                g_slice_free(dcerpc_fragment_key, key);
        }
 }
-#endif
+
 /*
  * Initialize a fragment table.
  */
@@ -356,22 +310,15 @@ fragment_table_init(GHashTable **fragment_table)
                 * the keys are freed by calling fragment_free_key()
                 * and the values are freed in free_all_fragments().
                 *
-                * If mem_chunks are used, the key and value data
-                * are freed by "reassemble_cleanup()". free_all_fragments()
+                * free_all_fragments()
                 * will free the adrress data associated with the key
                 */
                g_hash_table_foreach_remove(*fragment_table,
                                free_all_fragments, NULL);
        } else {
-#if GLIB_CHECK_VERSION(2,10,0)
                /* The fragment table does not exist. Create it */
                *fragment_table = g_hash_table_new_full(fragment_hash,
                                                        fragment_equal, fragment_free_key, NULL);
-#else
-               /* The fragment table does not exist. Create it */
-               *fragment_table = g_hash_table_new(fragment_hash,
-                               fragment_equal);
-#endif
        }
 }
 
@@ -388,22 +335,15 @@ dcerpc_fragment_table_init(GHashTable **fragment_table)
                 * the keys are freed by calling dcerpc_fragment_free_key()
                 * and the values are freed in free_all_fragments().
                 *
-                * If mem_chunks are used, the key and value data
-                * are freed by "reassemble_cleanup()". free_all_fragments()
+                * free_all_fragments()
                 * will free the adrress data associated with the key
                 */
                   g_hash_table_foreach_remove(*fragment_table,
                                                   free_all_fragments, NULL);
        } else {
-#if GLIB_CHECK_VERSION(2,10,0)
                   /* The fragment table does not exist. Create it */
                *fragment_table = g_hash_table_new_full(dcerpc_fragment_hash,
                                                        dcerpc_fragment_equal, dcerpc_fragment_free_key, NULL);
-#else
-               /* The fragment table does not exist. Create it */
-                  *fragment_table = g_hash_table_new(dcerpc_fragment_hash,
-                                                  dcerpc_fragment_equal);
-#endif
        }
 }
 
@@ -418,8 +358,7 @@ reassembled_table_init(GHashTable **reassembled_table)
                 * The reassembled-packet hash table exists.
                 *
                 * Remove all entries and free reassembled packet
-                * data for each entry.  (The key data is freed
-                * by "reassemble_cleanup()".)
+                * data for each entry.
                 */
                g_hash_table_foreach_remove(*reassembled_table,
                                free_all_reassembled_fragments, NULL);
@@ -430,48 +369,6 @@ reassembled_table_init(GHashTable **reassembled_table)
        }
 }
 
-/*
- * Free up all space allocated for fragment keys and data and
- * reassembled keys.
- */
-void
-reassemble_cleanup(void)
-{
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-       if (fragment_key_chunk != NULL)
-               g_mem_chunk_destroy(fragment_key_chunk);
-       if (dcerpc_fragment_key_chunk != NULL)
-               g_mem_chunk_destroy(dcerpc_fragment_key_chunk);
-       if (fragment_data_chunk != NULL)
-               g_mem_chunk_destroy(fragment_data_chunk);
-
-       fragment_key_chunk = NULL;
-       dcerpc_fragment_key_chunk = NULL;
-       fragment_data_chunk = NULL;
-#endif
-}
-
-void
-reassemble_init(void)
-{
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-       fragment_key_chunk = g_mem_chunk_new("fragment_key_chunk",
-               sizeof(fragment_key),
-               fragment_init_count * sizeof(fragment_key),
-               G_ALLOC_AND_FREE);
-       dcerpc_fragment_key_chunk = g_mem_chunk_new("dcerpc_fragment_key_chunk",
-               sizeof(dcerpc_fragment_key),
-               fragment_init_count * sizeof(dcerpc_fragment_key),
-               G_ALLOC_AND_FREE);
-       fragment_data_chunk = g_mem_chunk_new("fragment_data_chunk",
-               sizeof(fragment_data),
-               fragment_init_count * sizeof(fragment_data),
-               G_ALLOC_ONLY);
-#endif
-}
-
 /* This function cleans up the stored state and removes the reassembly data and
  * (with one exception) all allocated memory for matching reassembly.
  *
index f23824e29010162f6ddd4a91934f219b3a072fee..12e93a199c4ae0a0302c04555043dbbf93b6b5f3 100644 (file)
@@ -99,7 +99,6 @@ typedef struct _fragment_data {
 /* a function for copying hash keys */
 typedef void *(*fragment_key_copier)(const void *key);
 
-
 /*
  * Initialize a fragment table.
  */
@@ -111,16 +110,6 @@ extern void dcerpc_fragment_table_init(GHashTable **fragment_table);
  */
 extern void reassembled_table_init(GHashTable **reassembled_table);
 
-/*
- * Free up all space allocated for fragment keys and data.
- */
-void reassemble_cleanup(void);
-
-/*
- * Initialise fragment keys and data.
- */
-void reassemble_init(void);
-
 /*
  * This function adds a new fragment to the fragment hash table.
  * If this is the first fragment seen for this datagram, a new entry
index fe3e62c9c7b7044e2e5eff4cb6e4559403ede08a..6de2f664d7ab593518437dacfef77cf38bbb0102 100644 (file)
@@ -1654,8 +1654,6 @@ main(int argc _U_, char **argv _U_)
 
     /* initialise stuff */
     emem_init();
-    tvbuff_init();
-    reassemble_init();
 
     /* a tvbuff for testing with */
     data = g_malloc(DATA_LEN);
index ae3aa8aea86c13fa9b8e38cb62ec187ca00875c7..0a7c40eb7c46dc5e03a91c750e21a7e7a7ba6b19 100644 (file)
@@ -274,7 +274,7 @@ run_tests(void)
        tvbuff_t        *tvb_comp[6];
        guint           comp_length[6];
        int             len;
-       
+
        for (i = 0; i < 3; i++) {
                small[i] = g_new(guint8, 16);
 
@@ -340,7 +340,7 @@ run_tests(void)
 
        /* Composite tvbuffs don't work at the moment -- tests commented out until
         * they do. */
-       
+
        /* One Real */
        printf("Making Composite 0\n");
        tvb_comp[0]             = tvb_new_composite();
@@ -427,9 +427,7 @@ int
 main(void)
 {
        except_init();
-       tvbuff_init();
        run_tests();
-       tvbuff_cleanup();
        except_deinit();
        exit(failed?1:0);
 }
index a5d2df33303bdfed54fb11ee87afe54aaf58fbdc..0862ccf0e6caac5f65a260b5550694123f8776bb 100644 (file)
@@ -60,34 +60,6 @@ ensure_contiguous_no_exception(tvbuff_t *tvb, const gint offset, const gint leng
 static const guint8*
 ensure_contiguous(tvbuff_t *tvb, const gint offset, const gint length);
 
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-/* We dole out tvbuff's from this memchunk. */
-static GMemChunk *tvbuff_mem_chunk = NULL;
-#endif
-
-void
-tvbuff_init(void)
-{
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-       if (!tvbuff_mem_chunk)
-               tvbuff_mem_chunk = g_mem_chunk_create(tvbuff_t, 20, G_ALLOC_AND_FREE);
-#endif
-}
-
-void
-tvbuff_cleanup(void)
-{
-#if GLIB_CHECK_VERSION(2,10,0)
-#else
-       if (tvbuff_mem_chunk)
-               g_mem_chunk_destroy(tvbuff_mem_chunk);
-
-       tvbuff_mem_chunk = NULL;
-#endif
-}
-
 static void
 tvb_init(tvbuff_t *tvb, const tvbuff_type type)
 {
@@ -136,11 +108,7 @@ tvb_new(const tvbuff_type type)
 {
        tvbuff_t        *tvb;
 
-#if GLIB_CHECK_VERSION(2,10,0)
        tvb = g_slice_new(tvbuff_t);
-#else
-       tvb = g_chunk_new(tvbuff_t, tvbuff_mem_chunk);
-#endif
 
        tvb_init(tvb, type);
 
@@ -210,11 +178,7 @@ tvb_free(tvbuff_t* tvb)
                        g_slist_free(tvb->used_in);
                }
 
-#if GLIB_CHECK_VERSION(2,10,0)
                g_slice_free(tvbuff_t, tvb);
-#else
-               g_chunk_free(tvb, tvbuff_mem_chunk);
-#endif
        }
 }
 
index cab661f8616ab3b9222eb86b0c6a32709b4e5aba..5e75bce146f4a914168c32669066caf0793b56cb 100644 (file)
@@ -81,16 +81,6 @@ typedef struct tvbuff tvbuff_t;
 
 typedef void (*tvbuff_free_cb_t)(void*);
 
-
-/** "class" initialization. Called once during execution of program
- * so that tvbuff.c can initialize its data. */
-extern void tvbuff_init(void);
-
-/** "class" cleanup. Called once during execution of program
- * so that tvbuff.c can clean up its data. */
-extern void tvbuff_cleanup(void);
-
-
 /** Returns a pointer to a newly initialized tvbuff. Note that
  * tvbuff's of types TVBUFF_SUBSET and TVBUFF_COMPOSITE
  * require further initialization via the appropriate functions */
index e018d98d381e9a8618e3ed35402e1d42068d1ce9..fbd8e12eacce724fe7da8890b853f8aab2cd1cb7 100644 (file)
@@ -801,7 +801,6 @@ init_error_table_row(error_equiv_table *err, const expert_info_t *expert_data)
     g_snprintf(num, sizeof(num), "%d", expert_data->packet_num);
 #if 0
     This does not have a big performance improvment :(
-if GTK_CHECK_VERSION(2,10,0)
     gtk_tree_store_insert_with_values   (store,
                        &new_iter,   /* *iter */
                        &procedure->iter, /* *parent*/
index 47b8deff1ae29ff3b9246628364d8ed52d295295..d44c30ba673311cf88a73519e2bbfe2629ce05ee 100644 (file)
@@ -594,7 +594,6 @@ getenv_utf8(const char *varname)
        envvar = getenv(varname);
 
        /* since GLib 2.6 we need an utf8 version of the filename */
-#if GLIB_CHECK_VERSION(2,6,0)
        /* using the wide char version of getenv should work under all circumstances */
 
        /* convert given varname to utf16, needed by _wgetenv */
@@ -613,8 +612,6 @@ getenv_utf8(const char *varname)
        /* convert value to utf8 */
        envvar = g_utf16_to_utf8(envvarw, -1, NULL, NULL, NULL);
        /* XXX - memleak */
-#endif
 
        return envvar;
 }
-
index 29b9343a8ec1096b0afe34fc6fdc5da0523193e3..e50cf73708cdd9443e0945790a3060ed3b5a7c85 100644 (file)
@@ -52,9 +52,7 @@ extern "C" {
  *  must tweak a given filename from UTF8 to UTF16 as we use NT Unicode (Win9x
  *  - now unsupported - used locale based encoding here).
  */
-#if GLIB_CHECK_VERSION(2,6,0)
 
-/* Win32, GLib 2.6 or later */
 #include <stdio.h>
 
 extern int ws_stdio_open (const gchar *filename, int flags, int mode);
@@ -76,20 +74,6 @@ extern FILE * ws_stdio_freopen (const gchar *filename, const gchar *mode, FILE *
 #define ws_fopen       ws_stdio_fopen
 #define ws_freopen     ws_stdio_freopen
 
-#else /* GLIB_CHECK_VERSION(2,6,0) */
-
-/* Win32, GLib prior to 2.6 */
-#define ws_open                        _open
-#define ws_rename              rename
-#define ws_mkdir(dir,mode)     _mkdir(dir)     /* _mkdir() doesn't have a permission bits argument */
-#define ws_stat64              _stati64        /* use _stati64 for 64-bit size support */
-#define ws_unlink              _unlink
-#define ws_remove              remove
-#define ws_fopen               fopen
-#define ws_freopen             freopen
-
-#endif /* GLIB_CHECK_VERSION(2,6,0) */
-
 /*
  * These routines don't take pathnames, so they're the same regardless
  * of what version of GLib we have.