diff options
author | Timm Bäder <mail@baedert.org> | 2020-04-17 09:32:32 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2020-06-08 19:17:27 +0200 |
commit | fd7e209ce6c52a6213fe1438c80709bc39ea6695 (patch) | |
tree | 7e9a357f3bf2b9b87a3678a6dfb9b694bd5d979e /pango/pango-glyph-item.c | |
parent | 4289a208b8b1a67fb732c9f44e5eef0825f8c430 (diff) | |
download | pango-fd7e209ce6c52a6213fe1438c80709bc39ea6695.tar.gz |
glyph-item: Allocate attr iterator on the stack
Diffstat (limited to 'pango/pango-glyph-item.c')
-rw-r--r-- | pango/pango-glyph-item.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c index eb880608..326ae37f 100644 --- a/pango/pango-glyph-item.c +++ b/pango/pango-glyph-item.c @@ -24,6 +24,7 @@ #include "pango-glyph-item.h" #include "pango-impl-utils.h" +#include "pango-attributes-private.h" #define LTR(glyph_item) (((glyph_item)->item->analysis.level % 2) == 0) @@ -584,7 +585,7 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, const char *text, PangoAttrList *list) { - PangoAttrIterator *iter = pango_attr_list_get_iterator (list); + PangoAttrIterator iter; GSList *result = NULL; ApplyAttrsState state; gboolean start_new_segment = FALSE; @@ -607,15 +608,16 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, /* Advance the attr iterator to the start of the item */ + _pango_attr_list_get_iterator (list, &iter); do { - pango_attr_iterator_range (iter, &range_start, &range_end); + pango_attr_iterator_range (&iter, &range_start, &range_end); if (range_end > glyph_item->item->offset) break; } - while (pango_attr_iterator_next (iter)); + while (pango_attr_iterator_next (&iter)); - state.segment_attrs = pango_attr_iterator_get_attrs (iter); + state.segment_attrs = pango_attr_iterator_get_attrs (&iter); is_ellipsis = (glyph_item->item->analysis.flags & PANGO_ANALYSIS_FLAG_IS_ELLIPSIS) != 0; @@ -644,7 +646,7 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, { result = g_slist_prepend (result, split_before_cluster_start (&state)); - state.segment_attrs = pango_attr_iterator_get_attrs (iter); + state.segment_attrs = pango_attr_iterator_get_attrs (&iter); } start_new_segment = FALSE; @@ -663,8 +665,8 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, */ start_new_segment = TRUE; - have_next = pango_attr_iterator_next (iter); - pango_attr_iterator_range (iter, &range_start, &range_end); + have_next = pango_attr_iterator_next (&iter); + pango_attr_iterator_range (&iter, &range_start, &range_end); if (range_start >= state.iter.end_index) /* New range doesn't intersect this cluster */ { @@ -688,7 +690,7 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, } state.segment_attrs = g_slist_concat (state.segment_attrs, - pango_attr_iterator_get_attrs (iter)); + pango_attr_iterator_get_attrs (&iter)); } while (have_next); } @@ -702,7 +704,7 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, if (LTR (glyph_item)) result = g_slist_reverse (result); - pango_attr_iterator_destroy (iter); + _pango_attr_iterator_destroy (&iter); return result; } |