summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2021-07-01 16:55:52 -0500
committerFederico Mena Quintero <federico@gnome.org>2021-07-01 19:32:32 -0500
commitf651add3298878fe97b4da63e481b20f72c982aa (patch)
tree1cc27b0840e77875ad06b410ff706c485f2e162e
parentdf91ff22c83eb726e7f20bf714655ad1ea24832d (diff)
downloadpango-f651add3298878fe97b4da63e481b20f72c982aa.tar.gz
Extract function to free the contents of a PangoFcPatterns
-rw-r--r--pango/pangofc-fontmap.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 0df9de9f..ade1b38a 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -917,14 +917,9 @@ pango_fc_patterns_ref (PangoFcPatterns *pats)
}
static void
-pango_fc_patterns_unref (PangoFcPatterns *pats)
+free_patterns (gpointer data)
{
- g_return_if_fail (pats->ref_count > 0);
-
- pats->ref_count--;
-
- if (pats->ref_count)
- return;
+ PangoFcPatterns *pats = data;
/* Only remove from fontmap hash if we are in it. This is not necessarily
* the case after a cache_clear() call. */
@@ -944,7 +939,19 @@ pango_fc_patterns_unref (PangoFcPatterns *pats)
g_cond_clear (&pats->cond);
g_mutex_clear (&pats->mutex);
+}
+
+static void
+pango_fc_patterns_unref (PangoFcPatterns *pats)
+{
+ g_return_if_fail (pats->ref_count > 0);
+
+ pats->ref_count--;
+
+ if (pats->ref_count)
+ return;
+ free_patterns (pats);
g_slice_free (PangoFcPatterns, pats);
}