Skip to content

Commit 3bce116

Browse files
Zend/zend_types.h: move zend_result to separate header (#10609)
Many sources need just `zend_result`, and with this new header, they only need to include `zend_result.h` instead of `zend_types.h`; the latter is large and has fat dependencies, which slows down the build.
1 parent e52684e commit 3bce116

14 files changed

+50
-7
lines changed

Zend/Optimizer/zend_ssa.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "zend_optimizer.h"
2323
#include "zend_cfg.h"
24+
#include "zend_result.h"
2425

2526
typedef struct _zend_ssa_range {
2627
zend_long min;

Zend/zend_alloc.h

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

24+
#include "zend_result.h"
25+
2426
#include <stdio.h>
2527

2628
#include "../TSRM/TSRM.h"

Zend/zend_builtin_functions.h

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#ifndef ZEND_BUILTIN_FUNCTIONS_H
2121
#define ZEND_BUILTIN_FUNCTIONS_H
2222

23+
#include "zend_result.h"
24+
2325
zend_result zend_startup_builtin_functions(void);
2426

2527
BEGIN_EXTERN_C()

Zend/zend_exceptions.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#ifndef ZEND_EXCEPTIONS_H
2323
#define ZEND_EXCEPTIONS_H
2424

25+
#include "zend_result.h"
26+
2527
BEGIN_EXTERN_C()
2628

2729
extern ZEND_API zend_class_entry *zend_ce_throwable;

Zend/zend_extensions.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "zend_compile.h"
2424
#include "zend_build.h"
25+
#include "zend_result.h"
2526

2627
/*
2728
The constants below are derived from ext/opcache/ZendAccelerator.h

Zend/zend_highlight.h

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#ifndef ZEND_HIGHLIGHT_H
2121
#define ZEND_HIGHLIGHT_H
2222

23+
#include "zend_result.h"
24+
2325
#define HL_COMMENT_COLOR "#FF8000" /* orange */
2426
#define HL_DEFAULT_COLOR "#0000BB" /* blue */
2527
#define HL_HTML_COLOR "#000000" /* black */

Zend/zend_ini.h

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef ZEND_INI_H
2020
#define ZEND_INI_H
2121

22+
#include "zend_result.h"
23+
2224
#define ZEND_INI_USER (1<<0)
2325
#define ZEND_INI_PERDIR (1<<1)
2426
#define ZEND_INI_SYSTEM (1<<2)

Zend/zend_modules.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "zend.h"
2424
#include "zend_compile.h"
2525
#include "zend_build.h"
26+
#include "zend_result.h"
2627

2728
#define INIT_FUNC_ARGS int type, int module_number
2829
#define INIT_FUNC_ARGS_PASSTHRU type, module_number

Zend/zend_multibyte.h

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#ifndef ZEND_MULTIBYTE_H
2121
#define ZEND_MULTIBYTE_H
2222

23+
#include "zend_result.h"
24+
2325
typedef struct _zend_encoding zend_encoding;
2426

2527
typedef size_t (*zend_encoding_filter)(unsigned char **str, size_t *str_length, const unsigned char *buf, size_t length);

Zend/zend_operators.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#ifndef ZEND_OPERATORS_H
2222
#define ZEND_OPERATORS_H
2323

24+
#include "zend_result.h"
25+
2426
#include <errno.h>
2527
#include <math.h>
2628
#include <assert.h>

Zend/zend_result.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| Zend Engine |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
6+
+----------------------------------------------------------------------+
7+
| This source file is subject to version 2.00 of the Zend license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available through the world-wide-web at the following url: |
10+
| http://www.zend.com/license/2_00.txt. |
11+
| If you did not receive a copy of the Zend license and are unable to |
12+
| obtain it through the world-wide-web, please send a note to |
13+
| [email protected] so we can mail you a copy immediately. |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
#ifndef ZEND_RESULT_H
18+
#define ZEND_RESULT_H
19+
20+
typedef enum {
21+
SUCCESS = 0,
22+
FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */
23+
} ZEND_RESULT_CODE;
24+
25+
typedef ZEND_RESULT_CODE zend_result;
26+
27+
#endif /* ZEND_RESULT_H */

Zend/zend_stream.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#ifndef ZEND_STREAM_H
2323
#define ZEND_STREAM_H
2424

25+
#include "zend_result.h"
26+
2527
#include <sys/types.h>
2628
#include <sys/stat.h>
2729

Zend/zend_system_id.h

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef ZEND_SYSTEM_ID_H
1818
#define ZEND_SYSTEM_ID_H
1919

20+
#include "zend_result.h"
21+
2022
BEGIN_EXTERN_C()
2123
/* True global; Write-only during MINIT/startup */
2224
extern ZEND_API char zend_system_id[32];

Zend/zend_types.h

+2-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "zend_portability.h"
2626
#include "zend_long.h"
27+
#include "zend_result.h"
28+
2729
#include <stdbool.h>
2830

2931
#ifdef __SSE2__
@@ -49,13 +51,6 @@
4951

5052
typedef unsigned char zend_uchar;
5153

52-
typedef enum {
53-
SUCCESS = 0,
54-
FAILURE = -1, /* this MUST stay a negative number, or it may affect functions! */
55-
} ZEND_RESULT_CODE;
56-
57-
typedef ZEND_RESULT_CODE zend_result;
58-
5954
#ifdef ZEND_ENABLE_ZVAL_LONG64
6055
# ifdef ZEND_WIN32
6156
# define ZEND_SIZE_MAX _UI64_MAX

0 commit comments

Comments
 (0)