#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.
This commit is contained in:
Max Kellermann 2023-01-04 14:24:28 +01:00 committed by GitHub
parent 5ea9a7e219
commit e628c66f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 10 deletions

View File

@ -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"

View File

@ -21,10 +21,8 @@
#ifndef ZEND_ALLOC_H
#define ZEND_ALLOC_H
#include <stdio.h>
#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"

View File

@ -18,6 +18,7 @@
+----------------------------------------------------------------------+
*/
#include "zend_hash.h"
#include "zend.h"
#include "zend_globals.h"
#include "zend_variables.h"

View File

@ -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

View File

@ -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() }

View File

@ -17,9 +17,7 @@
+----------------------------------------------------------------------+
*/
#include "zend.h"
#include "zend_sort.h"
#include <limits.h>
static inline void zend_sort_2(void *a, void *b, compare_func_t cmp, swap_func_t swp) /* {{{ */ {
if (cmp(a, b) > 0) {

View File

@ -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);

View File

@ -16,6 +16,7 @@
+----------------------------------------------------------------------+
*/
#include "zend_string.h"
#include "zend.h"
#include "zend_globals.h"

View File

@ -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()