mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-05 04:06:11 -05:00
Use struct initializers instead of memset()
This is a bit more type-safe.
This commit is contained in:
parent
4966857f21
commit
7a9f8d8d6b
34 changed files with 134 additions and 113 deletions
|
|
@ -11,10 +11,11 @@ void wlr_buffer_init(struct wlr_buffer *buffer,
|
|||
assert(impl->begin_data_ptr_access && impl->end_data_ptr_access);
|
||||
}
|
||||
|
||||
memset(buffer, 0, sizeof(*buffer));
|
||||
buffer->impl = impl;
|
||||
buffer->width = width;
|
||||
buffer->height = height;
|
||||
*buffer = (struct wlr_buffer){
|
||||
.impl = impl,
|
||||
.width = width,
|
||||
.height = height,
|
||||
};
|
||||
wl_signal_init(&buffer->events.destroy);
|
||||
wl_signal_init(&buffer->events.release);
|
||||
wlr_addon_set_init(&buffer->addons);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ bool dmabuf_buffer_drop(struct wlr_dmabuf_buffer *buffer) {
|
|||
if (!wlr_dmabuf_attributes_copy(&saved_dmabuf, &buffer->dmabuf)) {
|
||||
wlr_log(WLR_ERROR, "Failed to save DMA-BUF");
|
||||
ok = false;
|
||||
memset(&buffer->dmabuf, 0, sizeof(buffer->dmabuf));
|
||||
buffer->dmabuf = (struct wlr_dmabuf_attributes){0};
|
||||
} else {
|
||||
buffer->dmabuf = saved_dmabuf;
|
||||
buffer->saved = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue