From e9967660b7a93988eb8a12a1dc188e04aada7583 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 17 Jul 2026 21:02:40 -0400 Subject: [PATCH] [client] clean up manual versions of ARRAY_LENGTH macro --- client/displayservers/X11/clipboard.c | 18 ++++++++++-------- client/renderers/EGL/egl.c | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/client/displayservers/X11/clipboard.c b/client/displayservers/X11/clipboard.c index f44920d3..2932a75a 100644 --- a/client/displayservers/X11/clipboard.c +++ b/client/displayservers/X11/clipboard.c @@ -29,6 +29,7 @@ #include #include "app.h" +#include "common/array.h" #include "common/debug.h" struct X11ClipboardState @@ -176,14 +177,15 @@ static void x11CBSelectionRequest(const XSelectionRequestEvent e) targets[1] = x11cb.aTypes[x11cb.type]; XChangeProperty( - e.display, - e.requestor, - e.property, - XA_ATOM, - 32, - PropModeReplace, - (unsigned char*)targets, - sizeof(targets) / sizeof(Atom)); + e.display, + e.requestor, + e.property, + XA_ATOM, + 32, + PropModeReplace, + (unsigned char*)targets, + ARRAY_LENGTH(targets) + ); goto send; } diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 1150b548..6f9c253c 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -21,6 +21,7 @@ #include "interface/renderer.h" #include "common/util.h" +#include "common/array.h" #include "common/debug.h" #include "common/KVMFR.h" #include "common/option.h" @@ -892,7 +893,7 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA) const char * configDesc = NULL; int chosen = -1; - for (int i = 0; i < (int)(sizeof(configs) / sizeof(configs[0])); ++i) + for (int i = 0; i < (int)ARRAY_LENGTH(configs); ++i) { if (configs[i].componentType == EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT && !hasFloatConfigs)