mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-06-16 02:48:29 +02:00
[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.
This commit is contained in:
parent
fd7d5d6e1d
commit
d9fb4d4bc5
1 changed files with 3 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue