diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-04-03 22:38:20 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-04-04 14:20:25 -0400 |
commit | 58e44e296f6e3657527f3c8a5203988339a8a0e5 (patch) | |
tree | 070ab4c67a4b46f265835ecdfb2a95189b324a43 /gtk/gtktextbtree.c | |
parent | 0334d002c00a9a33fb50bdab147a70b8952dc212 (diff) | |
download | gtk+-58e44e296f6e3657527f3c8a5203988339a8a0e5.tar.gz |
textbtree: Inline node data handling
Diffstat (limited to 'gtk/gtktextbtree.c')
-rw-r--r-- | gtk/gtktextbtree.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index 002f14245a..80c67d6deb 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -276,13 +276,6 @@ static void gtk_text_line_set_parent (GtkTextLine *line, static void gtk_text_btree_node_remove_data (GtkTextBTreeNode *node, gpointer view_id); - -static NodeData *node_data_new (gpointer view_id); -static void node_data_destroy (NodeData *nd); -static void node_data_list_destroy (NodeData *nd); -static NodeData *node_data_find (NodeData *nd, - gpointer view_id); - static GtkTextBTreeNode *gtk_text_btree_node_new (void); #if 0 static void gtk_text_btree_node_invalidate_downward (GtkTextBTreeNode *node); @@ -4817,15 +4810,16 @@ cleanup_line (GtkTextLine *line) * Nodes */ -static NodeData* -node_data_new (gpointer view_id) +static inline NodeData* +node_data_new (gpointer view_id, + NodeData *next) { NodeData *nd; nd = g_slice_new (NodeData); nd->view_id = view_id; - nd->next = NULL; + nd->next = next; nd->width = 0; nd->height = 0; nd->valid = FALSE; @@ -4833,19 +4827,19 @@ node_data_new (gpointer view_id) return nd; } -static void +static inline void node_data_destroy (NodeData *nd) { g_slice_free (NodeData, nd); } -static void +static inline void node_data_list_destroy (NodeData *nd) { g_slice_free_chain (NodeData, nd, next); } -static NodeData* +static inline NodeData* node_data_find (NodeData *nd, gpointer view_id) { @@ -5534,24 +5528,10 @@ gtk_text_btree_node_ensure_data (GtkTextBTreeNode *node, gpointer view_id) { NodeData *nd; - nd = node->node_data; - while (nd != NULL) - { - if (nd->view_id == view_id) - break; - - nd = nd->next; - } + nd = node_data_find (node->node_data, view_id); if (nd == NULL) - { - nd = node_data_new (view_id); - - if (node->node_data) - nd->next = node->node_data; - - node->node_data = nd; - } + nd = node->node_data = node_data_new (view_id, node->node_data); return nd; } |