[PATCH weston 2/3] xwm: Make hash_table_lookup use an output parameter

Bill Spitzak spitzak at gmail.com
Tue Apr 7 11:30:22 PDT 2015

On 04/07/2015 10:12 AM, Derek Foreman wrote:

> -	window = hash_table_lookup(wm->window_hash, leave->event);
> +	hash_table_lookup(wm->window_hash, leave->event, &window);
>   	if (!window || !window->decorate)
>   		return;

Shouldn't all of these patches use the return value, instead of ignoring 
it and/or checking the looked up value? How about:

	if (!hash_table_lookup(wm->window_hash, leave->event, &window))
	if (!window->decorate)

The main reason for making this change is that your version indicates 
that it is possible for it to return true and also set window to null, 
the above version makes it clear (imho) that a true return value also 
means window is not null.

More information about the wayland-devel mailing list