From 29f480d4ea5f6f7ea0ad996fe396c2a7eac23308 Mon Sep 17 00:00:00 2001 From: Ayman El Didi Date: Thu, 17 Feb 2022 23:26:27 -0700 Subject: [PATCH] renamed a confusingly named function in cairo-font-face.c I noticed a function called __put in cairo-font-face.c, and upon reading the commit message (337ab1f8d9e29086bfb4001508b28835b41c6390) learned that the purpose of the function was to decrement the refcount, checking if the decrement was the last one. This commit just renames the function to something more self-explanatory and removes code that's been commented out for 8 years. --- src/cairo-font-face.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cairo-font-face.c b/src/cairo-font-face.c index e10a6eac2..cd653c537 100644 --- a/src/cairo-font-face.c +++ b/src/cairo-font-face.c @@ -136,7 +136,7 @@ cairo_font_face_reference (cairo_font_face_t *font_face) slim_hidden_def (cairo_font_face_reference); static inline cairo_bool_t -__put(cairo_reference_count_t *v) +_cairo_decrement_refcount_return_was_last (cairo_reference_count_t *v) { int c, old; @@ -150,10 +150,7 @@ __put(cairo_reference_count_t *v) cairo_bool_t _cairo_font_face_destroy (void *abstract_face) { -#if 0 /* Nothing needs to be done, we can just drop the last reference */ - cairo_font_face_t *font_face = abstract_face; - return _cairo_reference_count_dec_and_test (&font_face->ref_count); -#endif + (void)abstract_face; return TRUE; } @@ -180,7 +177,7 @@ cairo_font_face_destroy (cairo_font_face_t *font_face) * FreeType backend where cairo_ft_font_face_t and cairo_ft_unscaled_font_t * need to effectively mutually reference each other */ - if (__put (&font_face->ref_count)) + if (_cairo_decrement_refcount_return_was_last (&font_face->ref_count)) return; if (! font_face->backend->destroy (font_face)) @@ -335,7 +332,7 @@ _cairo_unscaled_font_destroy (cairo_unscaled_font_t *unscaled_font) assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&unscaled_font->ref_count)); - if (__put (&unscaled_font->ref_count)) + if (_cairo_decrement_refcount_return_was_last (&unscaled_font->ref_count)) return; if (! unscaled_font->backend->destroy (unscaled_font))