Skip to content

Commit a49bb47

Browse files
committed
zend_API.h included
ZVAL_* family in use
1 parent 2966e63 commit a49bb47

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

Zend/zend_constants.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "zend_variables.h"
2626
#include "zend_operators.h"
2727
#include "zend_globals.h"
28-
28+
#include "zend_API.h"
2929

3030
void free_zend_constant(zend_constant *c)
3131
{
@@ -126,33 +126,29 @@ void zend_register_standard_constants(TSRMLS_D)
126126

127127
c.name = zend_strndup(ZEND_STRL("TRUE"));
128128
c.name_len = sizeof("TRUE");
129-
Z_LVAL(c.value) = 1;
130-
Z_TYPE(c.value) = IS_BOOL;
129+
ZVAL_BOOL(&c.value, 1);
131130
zend_register_constant(&c TSRMLS_CC);
132131

133132
c.name = zend_strndup(ZEND_STRL("FALSE"));
134133
c.name_len = sizeof("FALSE");
135-
Z_LVAL(c.value) = 0;
136-
Z_TYPE(c.value) = IS_BOOL;
134+
ZVAL_BOOL(&c.value, 0);
137135
zend_register_constant(&c TSRMLS_CC);
138136

139137
c.name = zend_strndup(ZEND_STRL("NULL"));
140138
c.name_len = sizeof("NULL");
141-
Z_TYPE(c.value) = IS_NULL;
139+
ZVAL_NULL(&c.value);
142140
zend_register_constant(&c TSRMLS_CC);
143141

144142
c.flags = CONST_PERSISTENT | CONST_CS;
145143

146144
c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
147145
c.name_len = sizeof("ZEND_THREAD_SAFE");
148-
Z_LVAL(c.value) = ZTS_V;
149-
Z_TYPE(c.value) = IS_BOOL;
146+
ZVAL_BOOL(&c.value, ZTS_V);
150147
zend_register_constant(&c TSRMLS_CC);
151148

152149
c.name = zend_strndup(ZEND_STRL("ZEND_DEBUG_BUILD"));
153150
c.name_len = sizeof("ZEND_DEBUG_BUILD");
154-
Z_LVAL(c.value) = ZEND_DEBUG;
155-
Z_TYPE(c.value) = IS_BOOL;
151+
ZVAL_BOOL(&c.value, ZEND_DEBUG);
156152
zend_register_constant(&c TSRMLS_CC);
157153
}
158154
}
@@ -179,8 +175,7 @@ ZEND_API void zend_register_bool_constant(const char *name, uint name_len, zend_
179175
{
180176
zend_constant c;
181177

182-
Z_TYPE(c.value) = IS_BOOL;
183-
Z_LVAL(c.value) = bval;
178+
ZVAL_BOOL(&c.value, bval);
184179
c.flags = flags;
185180
c.name = zend_strndup(name, name_len-1);
186181
c.name_len = name_len;
@@ -192,8 +187,7 @@ ZEND_API void zend_register_long_constant(const char *name, uint name_len, long
192187
{
193188
zend_constant c;
194189

195-
Z_TYPE(c.value) = IS_LONG;
196-
Z_LVAL(c.value) = lval;
190+
ZVAL_LONG(&c.value, lval);
197191
c.flags = flags;
198192
c.name = zend_strndup(name, name_len-1);
199193
c.name_len = name_len;
@@ -206,8 +200,7 @@ ZEND_API void zend_register_double_constant(const char *name, uint name_len, dou
206200
{
207201
zend_constant c;
208202

209-
Z_TYPE(c.value) = IS_DOUBLE;
210-
Z_DVAL(c.value) = dval;
203+
ZVAL_DOUBLE(&c.value, dval);
211204
c.flags = flags;
212205
c.name = zend_strndup(name, name_len-1);
213206
c.name_len = name_len;
@@ -220,9 +213,7 @@ ZEND_API void zend_register_stringl_constant(const char *name, uint name_len, ch
220213
{
221214
zend_constant c;
222215

223-
Z_TYPE(c.value) = IS_STRING;
224-
Z_STRVAL(c.value) = strval;
225-
Z_STRLEN(c.value) = strlen;
216+
ZVAL_STRINGL(&c.value, strval, strlen, 0);
226217
c.flags = flags;
227218
c.name = zend_strndup(name, name_len-1);
228219
c.name_len = name_len;

0 commit comments

Comments
 (0)