From 2f6a2107554eec004328e241228df49b004ce6c9 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 9 Mar 2024 20:30:08 +0100 Subject: [PATCH] Use memmove() unconditionally in the code (#13647) The memmove() function is C99 standard function [1] and check was left for the PCRE2 bundled library. It can be simplified by passing the compile option instead of checking always available function on current systems. External PCRE2 library on the system doesn't need this. [1]: https://port70.net/~nsz/c/c99/n1256.html#7.21.2.2 --- configure.ac | 1 - ext/pcre/config.w32 | 2 +- ext/pcre/config0.m4 | 2 +- win32/build/config.w32.h.in | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index b1ccafb181d..b1ebb74b85b 100644 --- a/configure.ac +++ b/configure.ac @@ -599,7 +599,6 @@ localtime_r \ lchown \ memcntl \ memfd_create \ -memmove \ mkstemp \ mmap \ nice \ diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32 index 619a868f847..2d3f8589e82 100644 --- a/ext/pcre/config.w32 +++ b/ext/pcre/config.w32 @@ -10,7 +10,7 @@ AC_DEFINE('PCRE2_CODE_UNIT_WIDTH', 8, 'Have PCRE library'); AC_DEFINE("PCRE2_STATIC", 1, ""); PHP_PCRE="yes"; PHP_INSTALL_HEADERS("ext/pcre", "php_pcre.h pcre2lib/"); -ADD_FLAG("CFLAGS_PCRE", " /D HAVE_CONFIG_H"); +ADD_FLAG("CFLAGS_PCRE", " /D HAVE_CONFIG_H /D HAVE_MEMMOVE"); ARG_WITH("pcre-jit", "Enable PCRE JIT support", "yes"); if (PHP_PCRE_JIT != "no") { diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 index 35b20750782..6d18b9ecf79 100644 --- a/ext/pcre/config0.m4 +++ b/ext/pcre/config0.m4 @@ -66,7 +66,7 @@ else pcre2lib/pcre2_string_utils.c pcre2lib/pcre2_study.c pcre2lib/pcre2_substitute.c pcre2lib/pcre2_substring.c \ pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \ pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c pcre2lib/pcre2_extuni.c pcre2lib/pcre2_script_run.c" - PHP_PCRE_CFLAGS="-Wno-implicit-fallthrough -DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" + PHP_PCRE_CFLAGS="-Wno-implicit-fallthrough -DHAVE_CONFIG_H -DHAVE_MEMMOVE -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ]) diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in index 0f0d7e4b804..4e4226f9c15 100644 --- a/win32/build/config.w32.h.in +++ b/win32/build/config.w32.h.in @@ -60,7 +60,6 @@ #undef HAVE_STRUCT_STAT_ST_BLOCKS #define HAVE_STRUCT_STAT_ST_RDEV 1 #define HAVE_GETLOGIN 1 -#define HAVE_MEMMOVE 1 #define HAVE_SHUTDOWN 1 #define HAVE_STRCASECMP 1 #define HAVE_UTIME 1