summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-12-02 03:12:24 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-12-02 03:12:24 +0000
commite2e3b87c73b049fe55540c5c3729840fbf5064d2 (patch)
tree14c33d0ecd4033a9fd02c29d82f2f8500f6a32ee
parent2e61f4d4c70cc721bf324484554f70b6a0cf3840 (diff)
downloadwireshark-e2e3b87c73b049fe55540c5c3729840fbf5064d2.tar.gz
performance enhancement:
in some profiling runs eth_clist_get_type() took ~6% change this to just a variable and initialize it explicitely from main.c svn path=/trunk/; revision=12653
-rw-r--r--gtk/ethclist.c21
-rw-r--r--gtk/ethclist.h7
-rw-r--r--gtk/main.c3
3 files changed, 15 insertions, 16 deletions
diff --git a/gtk/ethclist.c b/gtk/ethclist.c
index 4226d46c89..f9018b1504 100644
--- a/gtk/ethclist.c
+++ b/gtk/ethclist.c
@@ -479,15 +479,13 @@ static guint clist_signals[LAST_SIGNAL] = {0};
static GtkTargetEntry clist_target_table = { "gtk-clist-drag-reorder", 0, 0};
-GtkType
-eth_clist_get_type (void)
-{
- static GtkType clist_type = 0;
+GtkType eth_clist_type = 0;
- if (!clist_type)
- {
- static const GtkTypeInfo clist_info =
- {
+void
+init_eth_clist_type (void)
+{
+ static const GtkTypeInfo clist_info =
+ {
"EthCList",
sizeof (EthCList),
sizeof (EthCListClass),
@@ -496,12 +494,9 @@ eth_clist_get_type (void)
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
- };
-
- clist_type = gtk_type_unique (GTK_TYPE_CONTAINER, &clist_info);
- }
+ };
- return clist_type;
+ eth_clist_type = gtk_type_unique (GTK_TYPE_CONTAINER, &clist_info);
}
static void
diff --git a/gtk/ethclist.h b/gtk/ethclist.h
index 9d45f28703..27e990fb1b 100644
--- a/gtk/ethclist.h
+++ b/gtk/ethclist.h
@@ -89,7 +89,10 @@ typedef enum
ETH_BUTTON_EXPANDS = 1 << 2
} EthButtonAction;
-#define ETH_TYPE_CLIST (eth_clist_get_type ())
+extern GtkType eth_clist_type;
+void init_eth_clist_type (void);
+
+#define ETH_TYPE_CLIST (eth_clist_type)
#define ETH_CLIST(obj) (GTK_CHECK_CAST ((obj), ETH_TYPE_CLIST, EthCList))
#define ETH_CLIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), ETH_TYPE_CLIST, EthCListClass))
#define ETH_IS_CLIST(obj) (GTK_CHECK_TYPE ((obj), ETH_TYPE_CLIST))
@@ -442,8 +445,6 @@ struct _EthCell
} u;
};
-GtkType eth_clist_get_type (void);
-
/* constructors useful for gtk-- wrappers */
void eth_clist_construct (EthCList *clist,
gint columns,
diff --git a/gtk/main.c b/gtk/main.c
index ae4cfe190b..9a05186b4f 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -108,6 +108,7 @@
#ifdef _WIN32
#include "capture-wpcap.h"
#endif
+#include "ethclist.h"
/* GTK related */
#include "statusbar.h"
@@ -1590,6 +1591,8 @@ main(int argc, char *argv[])
/* Let GTK get its args */
gtk_init (&argc, &argv);
+ /* initialize our GTK eth_clist_type */
+ init_eth_clist_type();
ethereal_path = argv[0];