Add support for flags in the wl_map API and add a WL_MAP_ENTRY_LEGACY flag

The implementation in this commit allows for one bit worth of flags.  If
more flags are desired at a future date, then the wl_map implementation
will have to change but the wl_map API will not.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Jason Ekstrand 2013-06-01 17:40:53 -05:00 committed by Kristian Høgsberg
parent 28472970df
commit 2c7468b868
4 changed files with 58 additions and 20 deletions

View file

@ -226,7 +226,7 @@ wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)
proxy->refcount = 1;
pthread_mutex_lock(&display->mutex);
proxy->object.id = wl_map_insert_new(&display->objects, proxy);
proxy->object.id = wl_map_insert_new(&display->objects, 0, proxy);
pthread_mutex_unlock(&display->mutex);
return proxy;
@ -252,7 +252,7 @@ wl_proxy_create_for_id(struct wl_proxy *factory,
proxy->flags = 0;
proxy->refcount = 1;
wl_map_insert_at(&display->objects, id, proxy);
wl_map_insert_at(&display->objects, 0, id, proxy);
return proxy;
}
@ -273,10 +273,10 @@ wl_proxy_destroy(struct wl_proxy *proxy)
if (proxy->flags & WL_PROXY_FLAG_ID_DELETED)
wl_map_remove(&proxy->display->objects, proxy->object.id);
else if (proxy->object.id < WL_SERVER_ID_START)
wl_map_insert_at(&proxy->display->objects,
wl_map_insert_at(&proxy->display->objects, 0,
proxy->object.id, WL_ZOMBIE_OBJECT);
else
wl_map_insert_at(&proxy->display->objects,
wl_map_insert_at(&proxy->display->objects, 0,
proxy->object.id, NULL);
@ -522,11 +522,11 @@ wl_display_connect_to_fd(int fd)
wl_list_init(&display->event_queue_list);
pthread_mutex_init(&display->mutex, NULL);
wl_map_insert_new(&display->objects, NULL);
wl_map_insert_new(&display->objects, 0, NULL);
display->proxy.object.interface = &wl_display_interface;
display->proxy.object.id =
wl_map_insert_new(&display->objects, display);
wl_map_insert_new(&display->objects, 0, display);
display->proxy.display = display;
display->proxy.object.implementation = (void(**)(void)) &display_listener;
display->proxy.user_data = display;