diff options
author | Simon Ser <contact@emersion.fr> | 2023-07-07 14:34:56 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-07-07 17:31:11 +0200 |
commit | 7a9f8d8d6bf72fcea210552b7bec9b99f342f857 (patch) | |
tree | c84c622b9ea25646c081f81b534ec7c70b84ac84 /render/allocator | |
parent | 4966857f211cb6f48852928076a59f16aadb742b (diff) |
Use struct initializers instead of memset()
This is a bit more type-safe.
Diffstat (limited to 'render/allocator')
-rw-r--r-- | render/allocator/allocator.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/render/allocator/allocator.c b/render/allocator/allocator.c index 10284cdd..2b7da4f1 100644 --- a/render/allocator/allocator.c +++ b/render/allocator/allocator.c @@ -22,9 +22,10 @@ void wlr_allocator_init(struct wlr_allocator *alloc, const struct wlr_allocator_interface *impl, uint32_t buffer_caps) { assert(impl && impl->destroy && impl->create_buffer); - memset(alloc, 0, sizeof(*alloc)); - alloc->impl = impl; - alloc->buffer_caps = buffer_caps; + *alloc = (struct wlr_allocator){ + .impl = impl, + .buffer_caps = buffer_caps, + }; wl_signal_init(&alloc->events.destroy); } |