From ac7dcce4640047271d699fbb446137933b0f070e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:18:49 +0100 Subject: [PATCH 1/5] Zend/zend_portability: include php_config.h for HAVE_* --- Zend/zend_portability.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 7fdeedee19bf..6ddef3cd8312 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -21,6 +21,12 @@ #ifndef ZEND_PORTABILITY_H #define ZEND_PORTABILITY_H +#ifdef PHP_WIN32 +#include "config.w32.h" +#else +#include "php_config.h" // for HAVE_* +#endif + #ifdef __cplusplus #define BEGIN_EXTERN_C() extern "C" { #define END_EXTERN_C() } From 47bfb403c82fdc4d19b5f71ca6a7efee1fe26718 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:16:47 +0100 Subject: [PATCH 2/5] Zend/zend_sort: include cleanup Add missing #include lines to the header, so it can always be included without figuring out its header dependencies. --- Zend/zend_sort.c | 2 -- Zend/zend_sort.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Zend/zend_sort.c b/Zend/zend_sort.c index 355d2d1bad58..f43d5cae63f5 100644 --- a/Zend/zend_sort.c +++ b/Zend/zend_sort.c @@ -17,9 +17,7 @@ +----------------------------------------------------------------------+ */ -#include "zend.h" #include "zend_sort.h" -#include static inline void zend_sort_2(void *a, void *b, compare_func_t cmp, swap_func_t swp) /* {{{ */ { if (cmp(a, b) > 0) { diff --git a/Zend/zend_sort.h b/Zend/zend_sort.h index e606935f7902..320b5e56066a 100644 --- a/Zend/zend_sort.h +++ b/Zend/zend_sort.h @@ -20,6 +20,9 @@ #ifndef ZEND_SORT_H #define ZEND_SORT_H +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for compare_func_t, swap_func_t + BEGIN_EXTERN_C() ZEND_API void zend_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp); ZEND_API void zend_insert_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp); From 9b7b320319cee8e938f6d1987de17b54f2cb9aba Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:11:49 +0100 Subject: [PATCH 3/5] Zend/zend_alloc: include cleanup In the C file, include the header first so missing #includes are detected by the compiler, and use lighter header dependencies in the header, to speed up compile times. --- Zend/zend_alloc.c | 2 +- Zend/zend_alloc.h | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 5f11f49b0715..5f2f25c0c48f 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -51,8 +51,8 @@ * with more specialized routines when the requested size is known. */ -#include "zend.h" #include "zend_alloc.h" +#include "zend.h" #include "zend_globals.h" #include "zend_operators.h" #include "zend_multiply.h" diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 578d4c78cc5c..0fe1ff98c6f7 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -21,10 +21,8 @@ #ifndef ZEND_ALLOC_H #define ZEND_ALLOC_H -#include - -#include "../TSRM/TSRM.h" -#include "zend.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zend_result #ifndef ZEND_MM_ALIGNMENT # error "ZEND_MM_ALIGNMENT was not defined during configure" From f572a8ad4074bd74ebddae0d4de09a1fa9dc86da Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:10:03 +0100 Subject: [PATCH 4/5] Zend/zend_string: include cleanup --- Zend/zend_string.c | 1 + Zend/zend_string.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 68e6084fdf60..eef68c8e8aca 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -16,6 +16,7 @@ +----------------------------------------------------------------------+ */ +#include "zend_string.h" #include "zend.h" #include "zend_globals.h" diff --git a/Zend/zend_string.h b/Zend/zend_string.h index ed59ef82a14f..8705b4c300c5 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -19,7 +19,9 @@ #ifndef ZEND_STRING_H #define ZEND_STRING_H -#include "zend.h" +#include "zend_alloc.h" // for pemalloc() +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_types.h" // for zend_string BEGIN_EXTERN_C() From e39ba0b87d96cf8fe902c7800acf989ce4530130 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2023 10:13:07 +0100 Subject: [PATCH 5/5] Zend/zend_hash: include cleanup --- Zend/zend_hash.c | 1 + Zend/zend_hash.h | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index ef7111fafb5b..29cd57076e70 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -18,6 +18,7 @@ +----------------------------------------------------------------------+ */ +#include "zend_hash.h" #include "zend.h" #include "zend_globals.h" #include "zend_variables.h" diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 93b9f0d4530a..09495f5fb2ff 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -21,8 +21,11 @@ #ifndef ZEND_HASH_H #define ZEND_HASH_H -#include "zend.h" -#include "zend_sort.h" +#include "zend_alloc.h" // for pefree() +#include "zend_long.h" +#include "zend_portability.h" // for BEGIN_EXTERN_C +#include "zend_sort.h" // for zend_sort() +#include "zend_string.h" // for ZSTR_VAL() #define HASH_KEY_IS_STRING 1 #define HASH_KEY_IS_LONG 2