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

Carl Worth cworth at redhat.com
Thu Feb 24 13:22:25 PST 2005


On Thu, 24 Feb 2005 15:07:08 -0500, Owen Taylor wrote:
> The above typedef is also weird because it defines something
> that can't be used in isolation.

That's pretty compelling. And so far two people have said they've
never seen my style anywhere else, so I guess I must be the oddball on
this one. So * in the typedef wins.

> Actually, (GDestroyNotify) is one of the most common casts to type
> in GTK+ programming, since it's easier to define:
> 
>  void my_thing_destroy (MyThing *thing);

Ah, that's a good point.

And I do see that Kristian is already re-using the same destroy
typedef in the output stream stuff, so I'll withdraw my proposal to
cram "user_data" into the type as well.

If GDestroyNotify is common, then how about:

	typedef void (*cairo_destroy_notify_t) (void *data);

The word "notify" has the advantage of being two characters shorter
than "function" and only two characters longer than "func".

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050224/a7a42afa/attachment.pgp


More information about the cairo mailing list