Skip to content

Commit 02690fe

Browse files
MaxKellermannGirgias
authored andcommitted
Zend/zend_types.h: move zend_string to zend_string.h
It is now possible to include only `zend_string.h` without `zend_types.h`.
1 parent 42577c6 commit 02690fe

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

Zend/zend_alloc.h

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

24+
#include "zend_portability.h"
2425
#include "zend_result.h"
2526

2627
#include <stdio.h>
2728

2829
#include "../TSRM/TSRM.h"
29-
#include "zend.h"
3030

3131
#ifndef ZEND_MM_ALIGNMENT
3232
# error "ZEND_MM_ALIGNMENT was not defined during configure"

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
#include "zend_rc_debug.h"

Zend/zend_string.h

+19-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,26 @@
1919
#ifndef ZEND_STRING_H
2020
#define ZEND_STRING_H
2121

22-
#include "zend.h"
22+
#include "zend_alloc.h"
2323
#include "zend_char.h"
24+
#include "zend_portability.h"
25+
#include "zend_refcounted.h"
26+
27+
/* string flags (zval.value->gc.u.flags) */
28+
#define IS_STR_CLASS_NAME_MAP_PTR GC_PROTECTED /* refcount is a map_ptr offset of class_entry */
29+
#define IS_STR_INTERNED GC_IMMUTABLE /* interned string */
30+
#define IS_STR_PERSISTENT GC_PERSISTENT /* allocated using malloc */
31+
#define IS_STR_PERMANENT (1<<8) /* relives request boundary */
32+
#define IS_STR_VALID_UTF8 (1<<9) /* valid UTF-8 according to PCRE */
33+
34+
typedef struct _zend_string zend_string;
35+
36+
struct _zend_string {
37+
zend_refcounted_h gc;
38+
zend_ulong h; /* hash value */
39+
size_t len;
40+
char val[1];
41+
};
2442

2543
BEGIN_EXTERN_C()
2644

Zend/zend_types.h

-14
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,6 @@ struct _zval_struct {
331331
} u2;
332332
};
333333

334-
struct _zend_string {
335-
zend_refcounted_h gc;
336-
zend_ulong h; /* hash value */
337-
size_t len;
338-
char val[1];
339-
};
340-
341334
typedef struct _Bucket {
342335
zval val;
343336
zend_ulong h; /* hash value (or numeric index) */
@@ -627,13 +620,6 @@ static zend_always_inline uint8_t zval_get_type(const zval* pz) {
627620

628621
#define IS_CONSTANT_AST_EX (IS_CONSTANT_AST | (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT))
629622

630-
/* string flags (zval.value->gc.u.flags) */
631-
#define IS_STR_CLASS_NAME_MAP_PTR GC_PROTECTED /* refcount is a map_ptr offset of class_entry */
632-
#define IS_STR_INTERNED GC_IMMUTABLE /* interned string */
633-
#define IS_STR_PERSISTENT GC_PERSISTENT /* allocated using malloc */
634-
#define IS_STR_PERMANENT (1<<8) /* relives request boundary */
635-
#define IS_STR_VALID_UTF8 (1<<9) /* valid UTF-8 according to PCRE */
636-
637623
/* array flags */
638624
#define IS_ARRAY_IMMUTABLE GC_IMMUTABLE
639625
#define IS_ARRAY_PERSISTENT GC_PERSISTENT

0 commit comments

Comments
 (0)