server: add const qualifier to function arguments where possible

Makes it possible to e.g. `call wl_client_get_credentials` with a `const
struct wl_client *` from a global filter callback.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2023-07-06 18:18:37 +02:00 committed by Sebastian Wick
parent 597a6b94f5
commit bdba21ec92
3 changed files with 19 additions and 18 deletions

View file

@ -227,7 +227,7 @@ typedef void (*wl_global_bind_func_t)(struct wl_client *client, void *data,
uint32_t version, uint32_t id);
uint32_t
wl_display_get_serial(struct wl_display *display);
wl_display_get_serial(const struct wl_display *display);
uint32_t
wl_display_next_serial(struct wl_display *display);
@ -324,7 +324,7 @@ void
wl_client_flush(struct wl_client *client);
void
wl_client_get_credentials(struct wl_client *client,
wl_client_get_credentials(const struct wl_client *client,
pid_t *pid, uid_t *uid, gid_t *gid);
int
@ -586,7 +586,7 @@ void
wl_resource_destroy(struct wl_resource *resource);
uint32_t
wl_resource_get_id(struct wl_resource *resource);
wl_resource_get_id(const struct wl_resource *resource);
struct wl_list *
wl_resource_get_link(struct wl_resource *resource);
@ -607,7 +607,7 @@ void *
wl_resource_get_user_data(struct wl_resource *resource);
int
wl_resource_get_version(struct wl_resource *resource);
wl_resource_get_version(const struct wl_resource *resource);
void
wl_resource_set_destructor(struct wl_resource *resource,
@ -617,8 +617,9 @@ int
wl_resource_instance_of(struct wl_resource *resource,
const struct wl_interface *interface,
const void *implementation);
const char *
wl_resource_get_class(struct wl_resource *resource);
wl_resource_get_class(const struct wl_resource *resource);
void
wl_resource_add_destroy_listener(struct wl_resource *resource,
@ -654,16 +655,16 @@ void *
wl_shm_buffer_get_data(struct wl_shm_buffer *buffer);
int32_t
wl_shm_buffer_get_stride(struct wl_shm_buffer *buffer);
wl_shm_buffer_get_stride(const struct wl_shm_buffer *buffer);
uint32_t
wl_shm_buffer_get_format(struct wl_shm_buffer *buffer);
wl_shm_buffer_get_format(const struct wl_shm_buffer *buffer);
int32_t
wl_shm_buffer_get_width(struct wl_shm_buffer *buffer);
wl_shm_buffer_get_width(const struct wl_shm_buffer *buffer);
int32_t
wl_shm_buffer_get_height(struct wl_shm_buffer *buffer);
wl_shm_buffer_get_height(const struct wl_shm_buffer *buffer);
struct wl_shm_pool *
wl_shm_buffer_ref_pool(struct wl_shm_buffer *buffer);

View file

@ -619,7 +619,7 @@ err_client:
* \memberof wl_client
*/
WL_EXPORT void
wl_client_get_credentials(struct wl_client *client,
wl_client_get_credentials(const struct wl_client *client,
pid_t *pid, uid_t *uid, gid_t *gid)
{
if (pid)
@ -799,7 +799,7 @@ wl_resource_destroy(struct wl_resource *resource)
}
WL_EXPORT uint32_t
wl_resource_get_id(struct wl_resource *resource)
wl_resource_get_id(const struct wl_resource *resource)
{
return resource->object.id;
}
@ -853,7 +853,7 @@ wl_resource_get_user_data(struct wl_resource *resource)
}
WL_EXPORT int
wl_resource_get_version(struct wl_resource *resource)
wl_resource_get_version(const struct wl_resource *resource)
{
return resource->version;
}
@ -900,7 +900,7 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
* \memberof wl_resource
*/
WL_EXPORT const char *
wl_resource_get_class(struct wl_resource *resource)
wl_resource_get_class(const struct wl_resource *resource)
{
return resource->object.interface->name;
}
@ -1496,7 +1496,7 @@ wl_global_set_user_data(struct wl_global *global, void *data)
* \memberof wl_display
*/
WL_EXPORT uint32_t
wl_display_get_serial(struct wl_display *display)
wl_display_get_serial(const struct wl_display *display)
{
return display->serial;
}

View file

@ -445,7 +445,7 @@ wl_shm_buffer_get(struct wl_resource *resource)
}
WL_EXPORT int32_t
wl_shm_buffer_get_stride(struct wl_shm_buffer *buffer)
wl_shm_buffer_get_stride(const struct wl_shm_buffer *buffer)
{
return buffer->stride;
}
@ -479,19 +479,19 @@ wl_shm_buffer_get_data(struct wl_shm_buffer *buffer)
}
WL_EXPORT uint32_t
wl_shm_buffer_get_format(struct wl_shm_buffer *buffer)
wl_shm_buffer_get_format(const struct wl_shm_buffer *buffer)
{
return buffer->format;
}
WL_EXPORT int32_t
wl_shm_buffer_get_width(struct wl_shm_buffer *buffer)
wl_shm_buffer_get_width(const struct wl_shm_buffer *buffer)
{
return buffer->width;
}
WL_EXPORT int32_t
wl_shm_buffer_get_height(struct wl_shm_buffer *buffer)
wl_shm_buffer_get_height(const struct wl_shm_buffer *buffer)
{
return buffer->height;
}