mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 19:28:01 +02:00
[pattern] Silence compiler with impossible case.
Assert that the pattern is one of the four known types, and return an error so that the compiler knows that the local variable can not be used uninitialised.
This commit is contained in:
parent
5a76c233bf
commit
8bf109bd2a
1 changed files with 3 additions and 0 deletions
|
|
@ -272,6 +272,9 @@ _cairo_pattern_create_copy (cairo_pattern_t **pattern_out,
|
|||
case CAIRO_PATTERN_TYPE_RADIAL:
|
||||
pattern = malloc (sizeof (cairo_radial_pattern_t));
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED;
|
||||
return _cairo_error (CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
|
||||
}
|
||||
if (unlikely (pattern == NULL))
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue