aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/packet_list_store.c
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-08-15 05:26:02 +0000
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-08-15 05:26:02 +0000
commit3beae5944f126dbaa9a08a9e31cb07b68eac5296 (patch)
treec58526b01bf90db2bb658587b88fc7f53e44b546 /gtk/packet_list_store.c
parent68e07573bf8494448575ed93fe9c68a9d4ae0b2f (diff)
Micro optimize by storing PACKET_LIST(tree_model) into a local variable and using that instead of computing PACKET_LIST(tree_model) each time.
svn path=/trunk/; revision=29426
Diffstat (limited to 'gtk/packet_list_store.c')
-rw-r--r--gtk/packet_list_store.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c
index bb34c7527f..dd1e7d0ce8 100644
--- a/gtk/packet_list_store.c
+++ b/gtk/packet_list_store.c
@@ -277,11 +277,13 @@ packet_list_get_n_columns(GtkTreeModel *tree_model)
static GType
packet_list_get_column_type(GtkTreeModel *tree_model, gint index)
{
+ PacketList *packet_list;
g_return_val_if_fail(PACKETLIST_IS_LIST(tree_model), G_TYPE_INVALID);
- g_return_val_if_fail(index < PACKET_LIST(tree_model)->n_columns &&
+ packet_list = PACKET_LIST(tree_model);
+ g_return_val_if_fail(index < packet_list->n_columns &&
index >= 0, G_TYPE_INVALID);
- return PACKET_LIST(tree_model)->column_types[index];
+ return packet_list->column_types[index];
}
static gboolean
@@ -354,17 +356,15 @@ packet_list_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, gint column,
g_return_if_fail(PACKETLIST_IS_LIST(tree_model));
g_return_if_fail(iter != NULL);
- g_return_if_fail(column < PACKET_LIST(tree_model)->n_columns);
+ packet_list = PACKET_LIST(tree_model);
+ g_return_if_fail(column < packet_list->n_columns);
- type = PACKET_LIST(tree_model)->column_types[column];
+ type = packet_list->column_types[column];
g_value_init(value, type);
- packet_list = PACKET_LIST(tree_model);
-
record = (PacketListRecord*) iter->user_data;
- if(record->pos >= packet_list->num_rows)
- g_return_if_reached();
+ g_return_if_fail(record->pos < packet_list->num_rows);
/* XXX Probably the switch should be on column or
* should we allways return the pointer and read the data as required??