Smart comparing of wl_display_interfaces
Dmitry Cherkassov
dcherkassov at gmail.com
Wed Oct 15 11:44:25 PDT 2014
Hi list!
The definition of wl_display_interface symbol can come from
libwayland-server.so or libwayland-client.so.
There is a code in closed source EGL implementation that does
interfaces comparison via pointers, yielding negative results when
addresses are different (one address is saved by QtWayland, the other
one is from &wl_display_interface in EGL source code).
Is there a smarter way to compare wl_display_interface's?
There is this function:
wl_interface_equal(const struct wl_interface *a, const struct wl_interface *b)
{
return a == b || strcmp(a->name, b->name) == 0;
}
But as you can see it's not safe to use it alone because in case of
bad pointer we will get undefined results.
Currently struct wl_interface is the following:
struct wl_interface {
const char *name;
int version;
int method_count;
const struct wl_message *methods;
int event_count;
const struct wl_message *events;
};
Since there is no magic field at the beginning it is not possible to
see whether a pointer points to the valid wl_interface structure.
So my question is: how can we compare wl_interfaces in more clever and
safer way?
Thank you.
--
With best regards,
Dmitry
More information about the wayland-devel
mailing list