[PATCH wayland] server: add helper functions for wl_global

Bill Spitzak spitzak at gmail.com
Mon Feb 23 11:30:57 PST 2015


Which of the 4 arguments do you use for your use case?

Because this can only return the first match I suspect some of the NULL 
tests are pretty useless, because you have to specify arguments that you 
know will return the one and only instance you are interested in. It 
might be better to make this exactly match the use case you have. If you 
are passing NULL just remove that argument, and conversely remove the 
null test from this code for the arguments you send. Basically don't add 
code that is not certain to be useful.

On 02/23/2015 10:06 AM, Jonny Lamb wrote:

> +/** Find a wl_global given search parameters
> + *
> + * \param display The display object
> + * \param interface The interface to match, or NULL
> + * \param version The version to match, or 0
> + * \param data The user data to match, or NULL
> + * \param bind The function used to bind the object, or NULL
> + * \return The first wl_global which matches, or NULL
> + *
> + * The global list of a wl_display is not public so this function helps in
> + * finding a specific wl_global based on the parameters. Parameters can be
> + * missing for a broader search (NULL for interface, data, and bind, and 0 for
> + * version) but at least one must be present or no result will be returned.
> + *
> + * \memberof wl_global
> + */
> +WL_EXPORT struct wl_global *
> +wl_global_find(struct wl_display *display,
> +	const struct wl_interface *interface, uint32_t version,
> +	void *data, wl_global_bind_func_t bind)


More information about the wayland-devel mailing list