Re: [PATCH 15/72] image: typecasting helpers

"Enrico Weigelt, metux IT consult" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 29.12.2015 15:52, Chris Wilson wrote:
>> +static cairo_always_inline cairo_image_surface_t *
>> +_cairo_surface_cast_image ( cairo_surface_t *surface )
>> +{
>> +    assert (surface != NULL);
> 
> The assert here is pretty pointless. *NULL are easy enough to spot, all
> incoming surfaces are defined (either real or error surfaces, and we
> have said that anything else is undefined), so that leaves the internal
> surface passing for which we sometimes use a temporary NULL for
> unsupported.

Okay, at that specific point, the assert can be dropped.

I only added it, because quite recently we talked about adding more
asserts whereever some assumptions are made.

> I would rather see an attribute((nonnull)) annotations rather than
> assert (the attribute would need to be propagated back through the
> function pointers etc).

Yes, of course, but that probably would be a bigger changeset.

OTOH, I already planned a similar big change, replace void* by
cairo_surface_t ... should we do it that way (and also add nunnull
attribute ?

--mtx

--
Enrico Weigelt,
metux IT consulting
+49-151-27565287
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.