[cairo] Re: [PATCH] return write error from cairo_*_surface_create() if output file cannot be created

Behdad Esfahbod behdad at behdad.org
Fri Jan 26 15:23:31 PST 2007

On Wed, 2007-01-24 at 17:35 -0500, Eugeniy Meshcheryakov wrote:
> cairo-nil-surface-macro.diff:
> Adds macro for nil surfaces definition and uses it to define existing
> surfaces. 

I suggest you drop the symbol concatenation and take the full symbol
name as the second arg, so it's searchable.

Another problem with your patch is that it returns an image surface, for
ps/pdf/svg create functions.

I have another suggestion: currently the two nil surfaces in
cairo-surface.c are responsible for 576 bytes of per-process .data use
of cairo.  Of course, dropping them doesn't mean cairo can use
fewer .data pages (since it uses 1), but it's still a desired effect in
the long run as cairo's .data usage increases... So, What about dropping
the nil-surface idea and create an object and set its status correctly?
Currently we use nil objects when the failure happens in the
constructor.   If we implement the dummy-object idea I proposed in
another thread, we can return a newly allocated dummy object of the
correct type and set its error status to the desired error.  This way we
don't need to add static object for any new error that is returned from

Carl, what do you think?


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list