mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
connection: Move wl_interface_equal to util
Move the wl_interface_equal prototype to the top of wayland-private, where it is not buried in the middle of map, connection and closure functions. Move the implementation out of connection and into util. This is a utility function, not specific to connections, and has call sites within connection, wayland-client and wayland-server. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
e5b12aa827
commit
385906beae
3 changed files with 17 additions and 17 deletions
|
|
@ -797,19 +797,6 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
wl_interface_equal(const struct wl_interface *a, const struct wl_interface *b)
|
|
||||||
{
|
|
||||||
/* In most cases the pointer equality test is sufficient.
|
|
||||||
* However, in some cases, depending on how things are split
|
|
||||||
* across shared objects, we can end up with multiple
|
|
||||||
* instances of the interface metadata constants. So if the
|
|
||||||
* pointers match, the interfaces are equal, if they don't
|
|
||||||
* match we have to compare the interface names. */
|
|
||||||
|
|
||||||
return a == b || strcmp(a->name, b->name) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
|
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ struct wl_object {
|
||||||
extern struct wl_object global_zombie_object;
|
extern struct wl_object global_zombie_object;
|
||||||
#define WL_ZOMBIE_OBJECT ((void*)&global_zombie_object)
|
#define WL_ZOMBIE_OBJECT ((void*)&global_zombie_object)
|
||||||
|
|
||||||
|
int
|
||||||
|
wl_interface_equal(const struct wl_interface *iface1,
|
||||||
|
const struct wl_interface *iface2);
|
||||||
|
|
||||||
/* Flags for wl_map_insert_new and wl_map_insert_at. Flags can be queried with
|
/* Flags for wl_map_insert_new and wl_map_insert_at. Flags can be queried with
|
||||||
* wl_map_lookup_flags. The current implementation has room for 1 bit worth of
|
* wl_map_lookup_flags. The current implementation has room for 1 bit worth of
|
||||||
* flags. If more flags are ever added, the implementation of wl_map will have
|
* flags. If more flags are ever added, the implementation of wl_map will have
|
||||||
|
|
@ -103,10 +107,6 @@ struct wl_connection;
|
||||||
struct wl_closure;
|
struct wl_closure;
|
||||||
struct wl_proxy;
|
struct wl_proxy;
|
||||||
|
|
||||||
int
|
|
||||||
wl_interface_equal(const struct wl_interface *iface1,
|
|
||||||
const struct wl_interface *iface2);
|
|
||||||
|
|
||||||
struct wl_connection *
|
struct wl_connection *
|
||||||
wl_connection_create(int fd);
|
wl_connection_create(int fd);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,19 @@
|
||||||
|
|
||||||
struct wl_object global_zombie_object;
|
struct wl_object global_zombie_object;
|
||||||
|
|
||||||
|
int
|
||||||
|
wl_interface_equal(const struct wl_interface *a, const struct wl_interface *b)
|
||||||
|
{
|
||||||
|
/* In most cases the pointer equality test is sufficient.
|
||||||
|
* However, in some cases, depending on how things are split
|
||||||
|
* across shared objects, we can end up with multiple
|
||||||
|
* instances of the interface metadata constants. So if the
|
||||||
|
* pointers match, the interfaces are equal, if they don't
|
||||||
|
* match we have to compare the interface names.
|
||||||
|
*/
|
||||||
|
return a == b || strcmp(a->name, b->name) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
wl_list_init(struct wl_list *list)
|
wl_list_init(struct wl_list *list)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue