From d9fb4d4bc55eae42f6348b142e667be454064e2c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 29 Feb 2008 11:12:57 +0000 Subject: [PATCH] [cairo-ft-font] Simplify return of the nil font face during construction. Simply return the nil font face from the internal constructor rather than returning NULL and repeating the same fixup in the callers. --- src/cairo-ft-font.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 85ebce580..a781da420 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -2330,7 +2330,7 @@ _cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled, font_face = malloc (sizeof (cairo_ft_font_face_t)); if (!font_face) { _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); - return NULL; + return (cairo_font_face_t *)&_cairo_font_face_nil; } font_face->unscaled = unscaled; @@ -2508,10 +2508,7 @@ cairo_ft_font_face_create_for_pattern (FcPattern *pattern) font_face = _cairo_ft_font_face_create (unscaled, &ft_options); _cairo_unscaled_font_destroy (&unscaled->base); - if (font_face) - return font_face; - else - return (cairo_font_face_t *)&_cairo_font_face_nil; + return font_face; } /** @@ -2561,10 +2558,7 @@ cairo_ft_font_face_create_for_ft_face (FT_Face face, font_face = _cairo_ft_font_face_create (unscaled, &ft_options); _cairo_unscaled_font_destroy (&unscaled->base); - if (font_face) - return font_face; - else - return (cairo_font_face_t *)&_cairo_font_face_nil; + return font_face; } /**