Skip to content

Commit e2cd7de

Browse files
committed
Revert "Zend/zend_types.h: move IS_* to zend_type_code.h"
This reverts commit 0270a1e.
1 parent f760b13 commit e2cd7de

File tree

6 files changed

+39
-63
lines changed

6 files changed

+39
-63
lines changed

Zend/zend.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "zend_smart_str_public.h"
4040
#include "zend_smart_string_public.h"
4141
#include "zend_signal.h"
42-
#include "zend_type_code.h"
4342
#include "zend_max_execution_timer.h"
4443

4544
#define zend_sprintf sprintf

Zend/zend_API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "zend_variables.h"
2929
#include "zend_execute.h"
3030
#include "zend_type_info.h"
31-
#include "zend_type_code.h"
31+
3232

3333
BEGIN_EXTERN_C()
3434

Zend/zend_execute.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "zend_compile.h"
2525
#include "zend_hash.h"
2626
#include "zend_operators.h"
27-
#include "zend_type_code.h"
2827
#include "zend_variables.h"
2928

3029
#include <stdint.h>

Zend/zend_hash.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#include "zend.h"
2525
#include "zend_sort.h"
26-
#include "zend_type_code.h"
2726

2827
#define HASH_KEY_IS_STRING 1
2928
#define HASH_KEY_IS_LONG 2

Zend/zend_type_code.h

Lines changed: 0 additions & 58 deletions
This file was deleted.

Zend/zend_types.h

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "zend_long.h"
2727
#include "zend_rc_debug.h"
2828
#include "zend_result.h"
29-
#include "zend_type_code.h"
3029

3130
#include <stdbool.h>
3231
#include <stdint.h>
@@ -539,10 +538,48 @@ struct _zend_ast_ref {
539538
/*zend_ast ast; zend_ast follows the zend_ast_ref structure */
540539
};
541540

541+
/* Regular data types: Must be in sync with zend_variables.c. */
542+
#define IS_UNDEF 0
543+
#define IS_NULL 1
544+
#define IS_FALSE 2
545+
#define IS_TRUE 3
546+
#define IS_LONG 4
547+
#define IS_DOUBLE 5
548+
#define IS_STRING 6
549+
#define IS_ARRAY 7
550+
#define IS_OBJECT 8
551+
#define IS_RESOURCE 9
552+
#define IS_REFERENCE 10
553+
#define IS_CONSTANT_AST 11 /* Constant expressions */
554+
555+
/* Fake types used only for type hinting.
556+
* These are allowed to overlap with the types below. */
557+
#define IS_CALLABLE 12
558+
#define IS_ITERABLE 13
559+
#define IS_VOID 14
560+
#define IS_STATIC 15
561+
#define IS_MIXED 16
562+
#define IS_NEVER 17
563+
564+
/* internal types */
565+
#define IS_INDIRECT 12
566+
#define IS_PTR 13
567+
#define IS_ALIAS_PTR 14
568+
#define _IS_ERROR 15
569+
570+
/* used for casts */
571+
#define _IS_BOOL 18
572+
#define _IS_NUMBER 19
573+
542574
static zend_always_inline uint8_t zval_get_type(const zval* pz) {
543575
return pz->u1.v.type;
544576
}
545577

578+
#define ZEND_SAME_FAKE_TYPE(faketype, realtype) ( \
579+
(faketype) == (realtype) \
580+
|| ((faketype) == _IS_BOOL && ((realtype) == IS_TRUE || (realtype) == IS_FALSE)) \
581+
)
582+
546583
/* we should never set just Z_TYPE, we should set Z_TYPE_INFO */
547584
#define Z_TYPE(zval) zval_get_type(&(zval))
548585
#define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p))

0 commit comments

Comments
 (0)