summaryrefslogtreecommitdiff
path: root/pango/break.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-04-15 15:37:38 +0200
committerTimm Bäder <mail@baedert.org>2020-06-08 19:15:58 +0200
commitc802c85d0ed07cc1dae5db8f1991d82ec45bf1bd (patch)
tree09e48acfb8fd1822e5170b2b9894ee09f072328e /pango/break.c
parent25049ad1e41ad9127366e10c4c06ec56b5ffa69a (diff)
downloadpango-c802c85d0ed07cc1dae5db8f1991d82ec45bf1bd.tar.gz
Allocate internal PangoAttrLists on the stack
Diffstat (limited to 'pango/break.c')
-rw-r--r--pango/break.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/pango/break.c b/pango/break.c
index 875d776c..432ff493 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -24,6 +24,7 @@
#include "pango-break.h"
#include "pango-script-private.h"
#include "pango-emoji-private.h"
+#include "pango-attributes-private.h"
#include "pango-break-table.h"
#include "pango-impl-utils.h"
#include <string.h>
@@ -1905,31 +1906,31 @@ break_attrs (const char *text,
PangoLogAttr *log_attrs,
int log_attrs_len)
{
- PangoAttrList *list;
- PangoAttrIterator *iter;
+ PangoAttrList list;
+ PangoAttrIterator iter;
GSList *l;
- list = pango_attr_list_new ();
+ _pango_attr_list_init (&list);
for (l = attributes; l; l = l->next)
{
PangoAttribute *attr = l->data;
if (attr->klass->type == PANGO_ATTR_ALLOW_BREAKS)
- pango_attr_list_insert (list, pango_attribute_copy (attr));
+ pango_attr_list_insert (&list, pango_attribute_copy (attr));
}
- iter = pango_attr_list_get_iterator (list);
+ _pango_attr_list_get_iterator (&list, &iter);
do {
PangoAttribute *attr;
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_ALLOW_BREAKS);
+ attr = pango_attr_iterator_get (&iter, PANGO_ATTR_ALLOW_BREAKS);
if (attr && ((PangoAttrInt*)attr)->value == 0)
{
int start, end;
int start_pos, end_pos;
int pos;
- pango_attr_iterator_range (iter, &start, &end);
+ pango_attr_iterator_range (&iter, &start, &end);
if (start < offset)
start_pos = 0;
else
@@ -1946,10 +1947,10 @@ break_attrs (const char *text,
log_attrs[pos].is_char_break = FALSE;
}
}
- } while (pango_attr_iterator_next (iter));
+ } while (pango_attr_iterator_next (&iter));
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (list);
+ _pango_attr_iterator_destroy (&iter);
+ _pango_attr_list_destroy (&list);
return TRUE;
}