3
3
+----------------------------------------------------------------------+
4
4
| Zend Engine |
5
5
+----------------------------------------------------------------------+
6
- | Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) |
6
+ | Copyright (c) 1998-2007 Zend Technologies Ltd. (http://www.zend.com) |
7
7
+----------------------------------------------------------------------+
8
8
| This source file is subject to version 2.00 of the Zend license, |
9
9
| that is bundled with this package in the file LICENSE, and is |
@@ -58,11 +58,11 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
58
58
int i_op1, i_op2;
59
59
char str_result[MAX_LENGTH_OF_LONG];
60
60
61
- i_op1 = atoi (op1-> value . str . val );
62
- free (op1-> value . str . val );
61
+ i_op1 = atoi (Z_STRVAL_P ( op1) );
62
+ free (Z_STRVAL_P ( op1) );
63
63
if (op2) {
64
- i_op2 = atoi (op2-> value . str . val );
65
- free (op2-> value . str . val );
64
+ i_op2 = atoi (Z_STRVAL_P ( op2) );
65
+ free (Z_STRVAL_P ( op2) );
66
66
} else {
67
67
i_op2 = 0 ;
68
68
}
@@ -85,46 +85,46 @@ void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
85
85
break ;
86
86
}
87
87
88
- result-> value . str . len = zend_sprintf (str_result, " %d" , i_result);
89
- result-> value . str . val = (char *) malloc (result-> value . str . len +1 );
90
- memcpy (result-> value . str . val , str_result, result-> value . str . len );
91
- result-> value . str . val [ result-> value . str . len ] = 0 ;
92
- result-> type = IS_STRING;
88
+ Z_STRLEN_P ( result) = zend_sprintf (str_result, " %d" , i_result);
89
+ Z_STRVAL_P ( result) = (char *) malloc (Z_STRLEN_P ( result) +1 );
90
+ memcpy (Z_STRVAL_P ( result) , str_result, Z_STRLEN_P ( result) );
91
+ Z_STRVAL_P ( result)[ Z_STRLEN_P ( result) ] = 0 ;
92
+ Z_TYPE_P ( result) = IS_STRING;
93
93
}
94
94
95
95
void zend_ini_init_string (zval *result)
96
96
{
97
- result-> value . str . val = malloc (1 );
98
- result-> value . str . val [0 ] = 0 ;
99
- result-> value . str . len = 0 ;
100
- result-> type = IS_STRING;
97
+ Z_STRVAL_P ( result) = malloc (1 );
98
+ Z_STRVAL_P ( result) [0 ] = 0 ;
99
+ Z_STRLEN_P ( result) = 0 ;
100
+ Z_TYPE_P ( result) = IS_STRING;
101
101
}
102
102
103
103
void zend_ini_add_string (zval *result, zval *op1, zval *op2)
104
- {
105
- int length = op1-> value . str . len + op2-> value . str . len ;
106
-
107
- result-> value . str . val = (char *) realloc (op1-> value . str . val , length+1 );
108
- memcpy (result-> value . str . val + op1-> value . str . len , op2-> value . str . val , op2-> value . str . len );
109
- result-> value . str . val [length] = 0 ;
110
- result-> value . str . len = length;
111
- result-> type = IS_STRING;
104
+ {
105
+ int length = Z_STRLEN_P ( op1) + Z_STRLEN_P ( op2) ;
106
+
107
+ Z_STRVAL_P ( result) = (char *) realloc (Z_STRVAL_P ( op1) , length+1 );
108
+ memcpy (Z_STRVAL_P ( result)+ Z_STRLEN_P ( op1), Z_STRVAL_P ( op2), Z_STRLEN_P ( op2) );
109
+ Z_STRVAL_P ( result) [length] = 0 ;
110
+ Z_STRLEN_P ( result) = length;
111
+ Z_TYPE_P ( result) = IS_STRING;
112
112
}
113
113
114
114
void zend_ini_get_constant (zval *result, zval *name)
115
115
{
116
116
zval z_constant;
117
117
TSRMLS_FETCH ();
118
118
119
- if (!memchr (name-> value . str . val , ' :' , name-> value . str . len )
120
- && zend_get_constant (name-> value . str . val , name-> value . str . len , &z_constant TSRMLS_CC)) {
119
+ if (!memchr (Z_STRVAL_P ( name) , ' :' , Z_STRLEN_P ( name) )
120
+ && zend_get_constant (Z_STRVAL_P ( name), Z_STRLEN_P ( name) , &z_constant TSRMLS_CC)) {
121
121
/* z_constant is emalloc()'d */
122
122
convert_to_string (&z_constant);
123
- result-> value . str . val = zend_strndup (z_constant. value . str . val , z_constant. value . str . len );
124
- result-> value . str . len = z_constant. value . str . len ;
125
- result-> type = z_constant. type ;
123
+ Z_STRVAL_P ( result) = zend_strndup (Z_STRVAL ( z_constant), Z_STRLEN ( z_constant) );
124
+ Z_STRLEN_P ( result) = Z_STRLEN ( z_constant) ;
125
+ Z_TYPE_P ( result) = Z_TYPE ( z_constant) ;
126
126
zval_dtor (&z_constant);
127
- free (name-> value . str . val );
127
+ free (Z_STRVAL_P ( name));
128
128
} else {
129
129
*result = *name;
130
130
}
@@ -136,13 +136,13 @@ void zend_ini_get_var(zval *result, zval *name)
136
136
char *envvar;
137
137
TSRMLS_FETCH ();
138
138
139
- if (zend_get_configuration_directive (name-> value . str . val , name-> value . str . len +1 , &curval) == SUCCESS) {
140
- result-> value . str . val = zend_strndup (curval. value . str . val , curval. value . str . len );
141
- result-> value . str . len = curval. value . str . len ;
142
- } else if ((envvar = zend_getenv (name-> value . str . val , name-> value . str . len TSRMLS_CC)) != NULL ||
143
- (envvar = getenv (name-> value . str . val )) != NULL ) {
144
- result-> value . str . val = strdup (envvar);
145
- result-> value . str . len = strlen (envvar);
139
+ if (zend_get_configuration_directive (Z_STRVAL_P ( name), Z_STRLEN_P ( name) +1 , &curval) == SUCCESS) {
140
+ Z_STRVAL_P ( result) = zend_strndup (Z_STRVAL ( curval), Z_STRLEN ( curval) );
141
+ Z_STRLEN_P ( result) = Z_STRLEN ( curval) ;
142
+ } else if ((envvar = zend_getenv (Z_STRVAL_P ( name), Z_STRLEN_P ( name) TSRMLS_CC)) != NULL ||
143
+ (envvar = getenv (Z_STRVAL_P ( name) )) != NULL ) {
144
+ Z_STRVAL_P ( result) = strdup (envvar);
145
+ Z_STRLEN_P ( result) = strlen (envvar);
146
146
} else {
147
147
zend_ini_init_string (result);
148
148
}
@@ -252,22 +252,22 @@ statement_list:
252
252
statement :
253
253
TC_STRING ' =' string_or_value {
254
254
#if DEBUG_CFG_PARSER
255
- printf (" '%s' = '%s'\n " , $ 1 .value.str.val, $ 3 .value.str.val );
255
+ printf (" '%s' = '%s'\n " , Z_STRVAL($ 1 ), Z_STRVAL($ 3 ) );
256
256
#endif
257
257
ZEND_INI_PARSER_CB (&$1 , &$3 , ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG);
258
- free ($ 1 .value.str.val );
259
- free ($ 3 .value.str.val );
258
+ free (Z_STRVAL($ 1 ) );
259
+ free (Z_STRVAL($ 3 ) );
260
260
}
261
261
| TC_STRING BRACK ' =' string_or_value {
262
262
#if DEBUG_CFG_PARSER
263
- printf (" '%s'[ ] = '%s'\n " , $ 1 .value.str.val, $ 4 .value.str.val );
263
+ printf (" '%s'[ ] = '%s'\n " , Z_STRVAL($ 1 ), Z_STRVAL($ 4 ) );
264
264
#endif
265
265
ZEND_INI_PARSER_CB (&$1 , &$4 , ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG);
266
- free ($ 1 .value.str.val );
267
- free ($ 4 .value.str.val );
266
+ free (Z_STRVAL($ 1 ) );
267
+ free (Z_STRVAL($ 4 ) );
268
268
}
269
- | TC_STRING { ZEND_INI_PARSER_CB(&$1 , NULL , ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1 .value.str.val ); }
270
- | SECTION { ZEND_INI_PARSER_CB(&$1 , NULL , ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1 .value.str.val ); }
269
+ | TC_STRING { ZEND_INI_PARSER_CB(&$1 , NULL , ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free(Z_STRVAL( $1 ) ); }
270
+ | SECTION { ZEND_INI_PARSER_CB(&$1 , NULL , ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free(Z_STRVAL( $1 ) ); }
271
271
| ' \n'
272
272
;
273
273
@@ -286,7 +286,7 @@ var_string_list:
286
286
| TC_ENCAPSULATED_STRING { $$ = $1 ; }
287
287
| constant_string { $$ = $1 ; }
288
288
| var_string_list cfg_var_ref { zend_ini_add_string(&$$ , &$1 , &$2 ); free($2 .value.str.val); }
289
- | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$ , &$1 , &$2 ); free($2 .value.str.val ); }
289
+ | var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$ , &$1 , &$2 ); free(Z_STRVAL( $2 ) ); }
290
290
| var_string_list constant_string { zend_ini_add_string(&$$ , &$1 , &$2 ); free($2 .value.str.val); }
291
291
;
292
292
0 commit comments