API Shakeup: user data (was Re: [cairo] Patch improving fallbacks)

Keith Packard keithp at keithp.com
Tue Feb 15 14:36:10 PST 2005


Around 17 o'clock on Feb 15, =?UTF-8?B?S3Jpc3RpYW4gSMO4Z3NiZXJn?= wrote:

> >>What about just using a void pointer as key?

By using a specific (unusual) type as the key we prevent people from
accidentally inverting the two arguments.

const cairo_key_t	foo_key;

	cairo_surface_set_data (surface, &foo_key, data, destroy_data);

Using 'const' also avoids letting people pass it to the get_data 
function...

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050215/442b275c/attachment.pgp


More information about the cairo mailing list