From 417a66da5e8a98583661d08703a5c5562732678a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 5 Aug 2005 21:33:41 +0000 Subject: [PATCH] Simplify the implementation by taking advantage of the fact that destroy and reference are safe for NULL, and that reference returns its argument. --- ChangeLog | 7 +++++++ src/cairo-gstate.c | 7 ++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1606e4549..a653655aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-08-05 Carl Worth + + * src/cairo-gstate.c: (_cairo_gstate_set_font_face): Simplify the + implementation by taking advantage of the fact that destroy and + reference are safe for NULL, and that reference returns its + argument. + 2005-08-05 Carl Worth * src/cairo-gstate.c: (_cairo_gstate_translate), diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index d07051c4f..916b701fe 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -1653,11 +1653,8 @@ _cairo_gstate_set_font_face (cairo_gstate_t *gstate, return font_face->status; if (font_face != gstate->font_face) { - if (gstate->font_face) - cairo_font_face_destroy (gstate->font_face); - gstate->font_face = font_face; - if (gstate->font_face) - cairo_font_face_reference (gstate->font_face); + cairo_font_face_destroy (gstate->font_face); + gstate->font_face = cairo_font_face_reference (font_face); } _cairo_gstate_unset_scaled_font (gstate);