[cairo] API Shakeup: cairo_current_path -> cairo_copy_path_data

mental at rydia.net mental at rydia.net
Tue Feb 22 14:47:00 PST 2005


Quoting Carl Worth <cworth at cworth.org>:

> 	/* Get a copy of the current path.
>
> 	   Caller is responsible for the returned memory and should
> 	   free() it when finished.
> 	*/

Hmm.  I think it might be worth abstracting the free() -- i.e. have
a void cairo_free_path_data(cairo_t *cr, cairo_path_data_t *data)
or similar, so the door isn't totally closed on using an allocator
other than raw malloc().

This would permit things like using a per-cairo_t allocator/memory
pool for path data, or making the allocator pluggable as seems to
be inevitably required of widely used libraries.

Doing either at this stage would be extremely premature, but if the
intent is to finalize the API now, I think it's best to do so in a
way that leaves the door open for those kinds of optimizations in
the future were they to prove helpful.

-mental



More information about the cairo mailing list