treewide: make type-check helpers take const pointers

This commit is contained in:
YaoBing Xiao 2026-03-06 15:59:18 +08:00
parent 3336d28813
commit 14b3c96c1e
26 changed files with 38 additions and 38 deletions

View file

@ -95,7 +95,7 @@ static const struct wlr_backend_impl backend_impl = {
.commit = backend_commit,
};
bool wlr_backend_is_drm(struct wlr_backend *b) {
bool wlr_backend_is_drm(const struct wlr_backend *b) {
return b->impl == &backend_impl;
}

View file

@ -1299,7 +1299,7 @@ static const struct wlr_output_impl output_impl = {
.get_primary_formats = drm_connector_get_primary_formats,
};
bool wlr_output_is_drm(struct wlr_output *output) {
bool wlr_output_is_drm(const struct wlr_output *output) {
return output->impl == &output_impl;
}

View file

@ -81,6 +81,6 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_event_loop *loop) {
return &backend->backend;
}
bool wlr_backend_is_headless(struct wlr_backend *backend) {
bool wlr_backend_is_headless(const struct wlr_backend *backend) {
return backend->impl == &backend_impl;
}

View file

@ -106,7 +106,7 @@ static const struct wlr_output_impl output_impl = {
.move_cursor = output_move_cursor,
};
bool wlr_output_is_headless(struct wlr_output *wlr_output) {
bool wlr_output_is_headless(const struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl;
}

View file

@ -155,7 +155,7 @@ static const struct wlr_backend_impl backend_impl = {
.destroy = backend_destroy,
};
bool wlr_backend_is_libinput(struct wlr_backend *b) {
bool wlr_backend_is_libinput(const struct wlr_backend *b) {
return b->impl == &backend_impl;
}

View file

@ -173,7 +173,7 @@ struct wlr_backend *wlr_multi_backend_create(struct wl_event_loop *loop) {
return &backend->backend;
}
bool wlr_backend_is_multi(struct wlr_backend *b) {
bool wlr_backend_is_multi(const struct wlr_backend *b) {
return b->impl == &backend_impl;
}

View file

@ -577,7 +577,7 @@ static const struct wlr_backend_impl backend_impl = {
.get_drm_fd = backend_get_drm_fd,
};
bool wlr_backend_is_wl(struct wlr_backend *b) {
bool wlr_backend_is_wl(const struct wlr_backend *b) {
return b->impl == &backend_impl;
}

View file

@ -1027,7 +1027,7 @@ static const struct wlr_output_impl output_impl = {
.get_primary_formats = output_get_formats,
};
bool wlr_output_is_wl(struct wlr_output *wlr_output) {
bool wlr_output_is_wl(const struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl;
}

View file

@ -218,7 +218,7 @@ static const struct wlr_backend_impl backend_impl = {
.get_drm_fd = backend_get_drm_fd,
};
bool wlr_backend_is_x11(struct wlr_backend *backend) {
bool wlr_backend_is_x11(const struct wlr_backend *backend) {
return backend->impl == &backend_impl;
}

View file

@ -711,7 +711,7 @@ void handle_x11_configure_notify(struct wlr_x11_output *output,
wlr_output_state_finish(&state);
}
bool wlr_output_is_x11(struct wlr_output *wlr_output) {
bool wlr_output_is_x11(const struct wlr_output *wlr_output) {
return wlr_output->impl == &output_impl;
}

View file

@ -39,8 +39,8 @@ struct wlr_drm_lease {
struct wlr_backend *wlr_drm_backend_create(struct wlr_session *session,
struct wlr_device *dev, struct wlr_backend *parent);
bool wlr_backend_is_drm(struct wlr_backend *backend);
bool wlr_output_is_drm(struct wlr_output *output);
bool wlr_backend_is_drm(const struct wlr_backend *backend);
bool wlr_output_is_drm(const struct wlr_output *output);
/**
* Get the parent DRM backend, if any.

View file

@ -25,7 +25,7 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_event_loop *loop);
struct wlr_output *wlr_headless_add_output(struct wlr_backend *backend,
unsigned int width, unsigned int height);
bool wlr_backend_is_headless(struct wlr_backend *backend);
bool wlr_output_is_headless(struct wlr_output *output);
bool wlr_backend_is_headless(const struct wlr_backend *backend);
bool wlr_output_is_headless(const struct wlr_output *output);
#endif

View file

@ -29,7 +29,7 @@ struct libinput_device *wlr_libinput_get_device_handle(
struct libinput_tablet_tool *wlr_libinput_get_tablet_tool_handle(
struct wlr_tablet_tool *wlr_tablet_tool);
bool wlr_backend_is_libinput(struct wlr_backend *backend);
bool wlr_backend_is_libinput(const struct wlr_backend *backend);
bool wlr_input_device_is_libinput(struct wlr_input_device *device);
#endif

View file

@ -26,7 +26,7 @@ bool wlr_multi_backend_add(struct wlr_backend *multi,
void wlr_multi_backend_remove(struct wlr_backend *multi,
struct wlr_backend *backend);
bool wlr_backend_is_multi(struct wlr_backend *backend);
bool wlr_backend_is_multi(const struct wlr_backend *backend);
bool wlr_multi_is_empty(struct wlr_backend *backend);
void wlr_multi_for_each_backend(struct wlr_backend *backend,

View file

@ -46,7 +46,7 @@ struct wlr_output *wlr_wl_output_create_from_surface(struct wlr_backend *backend
/**
* Check whether the provided backend is a Wayland backend.
*/
bool wlr_backend_is_wl(struct wlr_backend *backend);
bool wlr_backend_is_wl(const struct wlr_backend *backend);
/**
* Check whether the provided input device is a Wayland input device.
@ -56,7 +56,7 @@ bool wlr_input_device_is_wl(struct wlr_input_device *device);
/**
* Check whether the provided output device is a Wayland output device.
*/
bool wlr_output_is_wl(struct wlr_output *output);
bool wlr_output_is_wl(const struct wlr_output *output);
/**
* Sets the title of a struct wlr_output which is a Wayland toplevel.

View file

@ -31,7 +31,7 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend);
/**
* Check whether this backend is an X11 backend.
*/
bool wlr_backend_is_x11(struct wlr_backend *backend);
bool wlr_backend_is_x11(const struct wlr_backend *backend);
/**
* Check whether this input device is an X11 input device.
@ -41,7 +41,7 @@ bool wlr_input_device_is_x11(struct wlr_input_device *device);
/**
* Check whether this output device is an X11 output device.
*/
bool wlr_output_is_x11(struct wlr_output *output);
bool wlr_output_is_x11(const struct wlr_output *output);
/**
* Sets the title of a struct wlr_output which is an X11 window.

View file

@ -42,9 +42,9 @@ struct wlr_gles2_texture_attribs {
bool has_alpha;
};
bool wlr_renderer_is_gles2(struct wlr_renderer *wlr_renderer);
bool wlr_render_timer_is_gles2(struct wlr_render_timer *timer);
bool wlr_texture_is_gles2(struct wlr_texture *texture);
bool wlr_renderer_is_gles2(const struct wlr_renderer *wlr_renderer);
bool wlr_render_timer_is_gles2(const struct wlr_render_timer *timer);
bool wlr_texture_is_gles2(const struct wlr_texture *texture);
void wlr_gles2_texture_get_attribs(struct wlr_texture *texture,
struct wlr_gles2_texture_attribs *attribs);

View file

@ -14,8 +14,8 @@
struct wlr_renderer *wlr_pixman_renderer_create(void);
bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_pixman(struct wlr_texture *texture);
bool wlr_renderer_is_pixman(const struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_pixman(const struct wlr_texture *texture);
pixman_image_t *wlr_pixman_renderer_get_buffer_image(
struct wlr_renderer *wlr_renderer, struct wlr_buffer *wlr_buffer);

View file

@ -25,8 +25,8 @@ VkPhysicalDevice wlr_vk_renderer_get_physical_device(struct wlr_renderer *render
VkDevice wlr_vk_renderer_get_device(struct wlr_renderer *renderer);
uint32_t wlr_vk_renderer_get_queue_family(struct wlr_renderer *renderer);
bool wlr_renderer_is_vk(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_vk(struct wlr_texture *texture);
bool wlr_renderer_is_vk(const struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_vk(const struct wlr_texture *texture);
void wlr_vk_texture_get_image_attribs(struct wlr_texture *texture,
struct wlr_vk_image_attribs *attribs);

View file

@ -82,9 +82,9 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
xcb_selection_notify_event_t *event);
int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
xcb_xfixes_selection_notify_event_t *event);
bool data_source_is_xwayland(struct wlr_data_source *wlr_source);
bool data_source_is_xwayland(const struct wlr_data_source *wlr_source);
bool primary_selection_source_is_xwayland(
struct wlr_primary_selection_source *wlr_source);
const struct wlr_primary_selection_source *wlr_source);
void xwm_seat_handle_start_drag(struct wlr_xwm *xwm, struct wlr_drag *drag);

View file

@ -29,7 +29,7 @@
static const struct wlr_renderer_impl renderer_impl;
static const struct wlr_render_timer_impl render_timer_impl;
bool wlr_renderer_is_gles2(struct wlr_renderer *wlr_renderer) {
bool wlr_renderer_is_gles2(const struct wlr_renderer *wlr_renderer) {
return wlr_renderer->impl == &renderer_impl;
}
@ -40,7 +40,7 @@ struct wlr_gles2_renderer *gles2_get_renderer(
return renderer;
}
bool wlr_render_timer_is_gles2(struct wlr_render_timer *timer) {
bool wlr_render_timer_is_gles2(const struct wlr_render_timer *timer) {
return timer->impl == &render_timer_impl;
}

View file

@ -16,7 +16,7 @@
static const struct wlr_texture_impl texture_impl;
bool wlr_texture_is_gles2(struct wlr_texture *wlr_texture) {
bool wlr_texture_is_gles2(const struct wlr_texture *wlr_texture) {
return wlr_texture->impl == &texture_impl;
}

View file

@ -12,7 +12,7 @@
static const struct wlr_renderer_impl renderer_impl;
bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer) {
bool wlr_renderer_is_pixman(const struct wlr_renderer *wlr_renderer) {
return wlr_renderer->impl == &renderer_impl;
}
@ -69,7 +69,7 @@ static struct wlr_pixman_buffer *get_buffer(
static const struct wlr_texture_impl texture_impl;
bool wlr_texture_is_pixman(struct wlr_texture *texture) {
bool wlr_texture_is_pixman(const struct wlr_texture *texture) {
return texture->impl == &texture_impl;
}

View file

@ -46,7 +46,7 @@ static bool default_debug = true;
static const struct wlr_renderer_impl renderer_impl;
bool wlr_renderer_is_vk(struct wlr_renderer *wlr_renderer) {
bool wlr_renderer_is_vk(const struct wlr_renderer *wlr_renderer) {
return wlr_renderer->impl == &renderer_impl;
}

View file

@ -15,7 +15,7 @@
static const struct wlr_texture_impl texture_impl;
bool wlr_texture_is_vk(struct wlr_texture *wlr_texture) {
bool wlr_texture_is_vk(const struct wlr_texture *wlr_texture) {
return wlr_texture->impl == &texture_impl;
}

View file

@ -249,7 +249,7 @@ struct x11_data_source {
static const struct wlr_data_source_impl data_source_impl;
bool data_source_is_xwayland(
struct wlr_data_source *wlr_source) {
const struct wlr_data_source *wlr_source) {
return wlr_source->impl == &data_source_impl;
}
@ -292,7 +292,7 @@ static const struct wlr_primary_selection_source_impl
primary_selection_source_impl;
bool primary_selection_source_is_xwayland(
struct wlr_primary_selection_source *wlr_source) {
const struct wlr_primary_selection_source *wlr_source) {
return wlr_source->impl == &primary_selection_source_impl;
}