Avoid using memcpy() to copy structs

We can just use a regular assignment instead. This is more
type-safe since there is no need to provide the struct size.

The remaining memcpy() calls perform array copies or copies from
void pointers (which may be unaligned).
This commit is contained in:
Simon Ser 2023-08-03 12:07:27 +02:00 committed by Alexander Orzechowski
parent 77dc1c28aa
commit c74f89d4f8
6 changed files with 7 additions and 7 deletions

View file

@ -129,7 +129,7 @@ static void drm_dumb_buffer_end_data_ptr_access(struct wlr_buffer *wlr_buffer) {
static bool buffer_get_dmabuf(struct wlr_buffer *wlr_buffer,
struct wlr_dmabuf_attributes *attribs) {
struct wlr_drm_dumb_buffer *buf = drm_dumb_buffer_from_buffer(wlr_buffer);
memcpy(attribs, &buf->dmabuf, sizeof(buf->dmabuf));
*attribs = buf->dmabuf;
return true;
}