From b4cf450ce1645e0b4f4a9ed38c975b50291696c4 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Wed, 28 Apr 2021 12:17:21 -0300 Subject: [PATCH] shared/helpers: use ARRAY_COPY where possible In "backend-drm: simplify compile time array copy", ARRAY_COPY was introduced to be used by the DRM-backend. In this patch we expand its usage to other code where hardcoded arrays are being copied. Signed-off-by: Leandro Ribeiro --- libweston/renderer-gl/gl-renderer.c | 4 ++-- tests/vertex-clip-test.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 3769c721..77022df1 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -3021,9 +3021,9 @@ gl_renderer_surface_copy_content(struct weston_surface *surface, glViewport(0, 0, cw, ch); glDisable(GL_BLEND); if (gs->y_inverted) - memcpy(sconf.projection.d, projmat_normal, sizeof projmat_normal); + ARRAY_COPY(sconf.projection.d, projmat_normal); else - memcpy(sconf.projection.d, projmat_yinvert, sizeof projmat_yinvert); + ARRAY_COPY(sconf.projection.d, projmat_yinvert); sconf.projection.type = WESTON_MATRIX_TRANSFORM_SCALE | WESTON_MATRIX_TRANSFORM_TRANSLATE; diff --git a/tests/vertex-clip-test.c b/tests/vertex-clip-test.c index ce876cec..3e62412c 100644 --- a/tests/vertex-clip-test.c +++ b/tests/vertex-clip-test.c @@ -176,8 +176,8 @@ static void deep_copy_polygon8(const struct polygon8 *src, struct polygon8 *dst) { dst->n = src->n; - memcpy((void *) dst->x, src->x, sizeof (src->x)); - memcpy((void *) dst->y, src->y, sizeof (src->y)); + ARRAY_COPY(dst->x, src->x); + ARRAY_COPY(dst->y, src->y); } TEST_P(clip_polygon_n_vertices_emitted, test_data)