From da8241cff67d36e866efddc89ebc085bdb86c4d3 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 26 Jan 2025 11:41:36 +0000 Subject: [PATCH] Remove test for, and fallback impl of, wmemchr. This was introduced in commit e7acb9f6968d482, as a side effect of also wanting to call wmemchr to find a NUL wide character in the buffer returned from GetDlgItemTextW. But the previous commit has superseded that code, so now we don't use wmemchr in this code base any more. Remove the machinery that provides it, saving a now-useless cmake configure-time check. --- cmake/cmake.h.in | 1 - cmake/platforms/windows.cmake | 1 - defs.h | 5 ----- windows/CMakeLists.txt | 3 --- windows/utils/wmemchr.c | 15 --------------- 5 files changed, 25 deletions(-) delete mode 100644 windows/utils/wmemchr.c diff --git a/cmake/cmake.h.in b/cmake/cmake.h.in index cb389cb6..3d36b3d0 100644 --- a/cmake/cmake.h.in +++ b/cmake/cmake.h.in @@ -15,7 +15,6 @@ #cmakedefine01 HAVE_GETNAMEDPIPECLIENTPROCESSID #cmakedefine01 HAVE_SETDEFAULTDLLDIRECTORIES #cmakedefine01 HAVE_STRTOUMAX -#cmakedefine01 HAVE_WMEMCHR #cmakedefine01 HAVE_DWMAPI_H #cmakedefine NOT_X_WINDOWS diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index e87f3380..481809ec 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -53,7 +53,6 @@ define_negation(NO_HTMLHELP HAVE_HTMLHELP_H) check_include_files("winsock2.h;afunix.h" HAVE_AFUNIX_H) check_symbol_exists(strtoumax "inttypes.h" HAVE_STRTOUMAX) -check_symbol_exists(wmemchr "wchar.h" HAVE_WMEMCHR) check_symbol_exists(AddDllDirectory "windows.h" HAVE_ADDDLLDIRECTORY) check_symbol_exists(SetDefaultDllDirectories "windows.h" HAVE_SETDEFAULTDLLDIRECTORIES) diff --git a/defs.h b/defs.h index 0e56eb78..0ac23ee2 100644 --- a/defs.h +++ b/defs.h @@ -53,11 +53,6 @@ uintmax_t strtoumax(const char *nptr, char **endptr, int base); #define SIZEu "zu" #endif -#if !HAVE_WMEMCHR -/* Work around lack of wmemchr in older MSVC */ -wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n); -#endif - #if defined __GNUC__ || defined __clang__ /* * On MinGW, the correct compiler format checking for vsnprintf() etc diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 7d4fcadb..960a440d 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -42,9 +42,6 @@ add_sources_from_current_dir(utils if(NOT HAVE_STRTOUMAX) add_sources_from_current_dir(utils utils/strtoumax.c) endif() -if(NOT HAVE_WMEMCHR) - add_sources_from_current_dir(utils utils/wmemchr.c) -endif() add_sources_from_current_dir(eventloop cliloop.c handle-wait.c) add_sources_from_current_dir(console diff --git a/windows/utils/wmemchr.c b/windows/utils/wmemchr.c deleted file mode 100644 index 7ccdfe3c..00000000 --- a/windows/utils/wmemchr.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Work around lack of wmemchr in older MSVC libraries. - */ - -#include - -#include "defs.h" - -wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n) -{ - for (; n != 0; s++, n--) - if (*s == c) - return (wchar_t *)s; - return NULL; -}