[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:
Chris Wilson 2009-04-16 17:17:06 +01:00
parent 5a76c233bf
commit 8bf109bd2a

View file

@ -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);