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
This commit is contained in:
Ronnie Sahlberg 2004-12-02 03:12:24 +00:00
parent 2e61f4d4c7
commit e2e3b87c73
3 changed files with 15 additions and 16 deletions

View File

@ -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

View File

@ -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,

View File

@ -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];