From 2430d6b7f76e1e6db7a8d35f78125e68afc025e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 22 Mar 2022 19:04:29 +0100 Subject: [PATCH] Wayland: Remove superfluous global struct member It seems unlikely that strlen will be a bottleneck when sending clipboard contents. (cherry picked from commit 738b1c73b5433c0a3c76f2b14728a5c0ba515643) --- src/wl_platform.h | 1 - src/wl_window.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index dab4c0a5..aaf767c3 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -258,7 +258,6 @@ typedef struct _GLFWlibraryWayland char* clipboardString; size_t clipboardSize; char* clipboardSendString; - size_t clipboardSendSize; int timerfd; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; diff --git a/src/wl_window.c b/src/wl_window.c index e425da78..ee4a26f6 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1726,7 +1726,7 @@ static void dataSourceHandleSend(void* data, int fd) { const char* string = _glfw.wl.clipboardSendString; - size_t len = _glfw.wl.clipboardSendSize; + size_t len = strlen(string); int ret; if (_glfw.wl.dataSource != dataSource) @@ -1809,7 +1809,6 @@ void _glfwPlatformSetClipboardString(const char* string) free(_glfw.wl.clipboardSendString); _glfw.wl.clipboardSendString = copy; - _glfw.wl.clipboardSendSize = strlen(_glfw.wl.clipboardSendString); _glfw.wl.dataSource = wl_data_device_manager_create_data_source(_glfw.wl.dataDeviceManager); if (!_glfw.wl.dataSource)