Skip to content

Commit e628c66

Browse files
#include cleanup (#10216)
Shift header include 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.
1 parent 5ea9a7e commit e628c66

9 files changed

+22
-10
lines changed

Zend/zend_alloc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
* with more specialized routines when the requested size is known.
5252
*/
5353

54-
#include "zend.h"
5554
#include "zend_alloc.h"
55+
#include "zend.h"
5656
#include "zend_globals.h"
5757
#include "zend_operators.h"
5858
#include "zend_multiply.h"

Zend/zend_alloc.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
#ifndef ZEND_ALLOC_H
2222
#define ZEND_ALLOC_H
2323

24-
#include <stdio.h>
25-
26-
#include "../TSRM/TSRM.h"
27-
#include "zend.h"
24+
#include "zend_portability.h" // for BEGIN_EXTERN_C
25+
#include "zend_types.h" // for zend_result
2826

2927
#ifndef ZEND_MM_ALIGNMENT
3028
# error "ZEND_MM_ALIGNMENT was not defined during configure"

Zend/zend_hash.c

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
+----------------------------------------------------------------------+
1919
*/
2020

21+
#include "zend_hash.h"
2122
#include "zend.h"
2223
#include "zend_globals.h"
2324
#include "zend_variables.h"

Zend/zend_hash.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
#ifndef ZEND_HASH_H
2222
#define ZEND_HASH_H
2323

24-
#include "zend.h"
25-
#include "zend_sort.h"
24+
#include "zend_alloc.h" // for pefree()
25+
#include "zend_long.h"
26+
#include "zend_portability.h" // for BEGIN_EXTERN_C
27+
#include "zend_sort.h" // for zend_sort()
28+
#include "zend_string.h" // for ZSTR_VAL()
2629

2730
#define HASH_KEY_IS_STRING 1
2831
#define HASH_KEY_IS_LONG 2

Zend/zend_portability.h

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
#ifndef ZEND_PORTABILITY_H
2222
#define ZEND_PORTABILITY_H
2323

24+
#ifdef PHP_WIN32
25+
#include "config.w32.h"
26+
#else
27+
#include "php_config.h" // for HAVE_*
28+
#endif
29+
2430
#ifdef __cplusplus
2531
#define BEGIN_EXTERN_C() extern "C" {
2632
#define END_EXTERN_C() }

Zend/zend_sort.c

-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
+----------------------------------------------------------------------+
1818
*/
1919

20-
#include "zend.h"
2120
#include "zend_sort.h"
22-
#include <limits.h>
2321

2422
static inline void zend_sort_2(void *a, void *b, compare_func_t cmp, swap_func_t swp) /* {{{ */ {
2523
if (cmp(a, b) > 0) {

Zend/zend_sort.h

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#ifndef ZEND_SORT_H
2121
#define ZEND_SORT_H
2222

23+
#include "zend_portability.h" // for BEGIN_EXTERN_C
24+
#include "zend_types.h" // for compare_func_t, swap_func_t
25+
2326
BEGIN_EXTERN_C()
2427
ZEND_API void zend_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp);
2528
ZEND_API void zend_insert_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp);

Zend/zend_string.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19+
#include "zend_string.h"
1920
#include "zend.h"
2021
#include "zend_globals.h"
2122

Zend/zend_string.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#ifndef ZEND_STRING_H
2020
#define ZEND_STRING_H
2121

22-
#include "zend.h"
22+
#include "zend_alloc.h" // for pemalloc()
23+
#include "zend_portability.h" // for BEGIN_EXTERN_C
24+
#include "zend_types.h" // for zend_string
2325

2426
BEGIN_EXTERN_C()
2527

0 commit comments

Comments
 (0)