25
25
#include " zend_hash.h"
26
26
#include " zend_list.h"
27
27
28
- # define PAA_LENGTH_ADJ (l ) (l)
29
- # define PAA_SYM_EXISTS zend_symtable_str_exists
30
- # define PAA_SYM_DEL zend_symtable_str_del
31
- # define PAA_LONG zend_long
32
- # define PAA_ULONG zend_ulong
33
-
34
28
/* *
35
29
* All APIs in this file follow a general format:
36
30
*
73
67
*/
74
68
static inline
75
69
zend_bool php_array_exists (zval *zarr, const char *key) {
76
- return PAA_SYM_EXISTS (Z_ARRVAL_P (zarr), key, PAA_LENGTH_ADJ ( strlen (key) ));
70
+ return zend_symtable_str_exists (Z_ARRVAL_P (zarr), key, strlen (key));
77
71
}
78
72
#define php_array_existsc (zarr, litstr ) \
79
- PAA_SYM_EXISTS (Z_ARRVAL_P(zarr), litstr, PAA_LENGTH_ADJ( sizeof (litstr) - 1) )
73
+ zend_symtable_str_exists (Z_ARRVAL_P(zarr), litstr, sizeof(litstr) - 1)
80
74
#define php_array_existsl (zarr, key, len ) \
81
- PAA_SYM_EXISTS (Z_ARRVAL_P(zarr), key, PAA_LENGTH_ADJ( len) )
75
+ zend_symtable_str_exists (Z_ARRVAL_P(zarr), key, len)
82
76
static inline
83
77
zend_bool php_array_existsl_safe(zval *zarr, const char *key, int key_len) {
84
78
zend_string *keystr = zend_string_init (key, key_len, 0 );
@@ -171,7 +165,7 @@ zval *php_array_fetchl_safe(zval *zarr, const char *key, int key_len) {
171
165
return ret;
172
166
}
173
167
static inline
174
- zval *php_array_fetchn (zval *zarr, PAA_ULONG idx) {
168
+ zval *php_array_fetchn (zval *zarr, zend_ulong idx) {
175
169
return zend_hash_index_find (Z_ARRVAL_P (zarr), idx);
176
170
}
177
171
static inline
@@ -201,7 +195,7 @@ static inline ctype php_array_fetchl_##ztype(zval *zarr, const char *key, int ke
201
195
{ return php_array_zval_to_##ztype (php_array_fetchl (zarr, key, key_len)); } \
202
196
static inline ctype php_array_fetchl_safe_##ztype(zval *zarr, const char *key, int key_len) \
203
197
{ return php_array_zval_to_##ztype (php_array_fetchl_safe (zarr, key, key_len)); } \
204
- static inline ctype php_array_fetchn_##ztype(zval *zarr, PAA_ULONG idx) \
198
+ static inline ctype php_array_fetchn_##ztype(zval *zarr, zend_ulong idx) \
205
199
{ return php_array_zval_to_##ztype (php_array_fetchn (zarr, idx)); } \
206
200
static inline ctype php_array_fetchz_##ztype(zval *zarr, zval *key) \
207
201
{ return php_array_zval_to_##ztype (php_array_fetchz (zarr, key)); }
@@ -233,7 +227,7 @@ PHP_ARRAY_FETCH_TYPE_MAP(zend_bool, bool)
233
227
* long php_array_fetchz_long(zval *zarr, zval *key)
234
228
*/
235
229
static inline
236
- PAA_LONG php_array_zval_to_long(zval *z) {
230
+ zend_long php_array_zval_to_long(zval *z) {
237
231
try_again:
238
232
if (!z) { return 0 ; }
239
233
switch (Z_TYPE_P (z)) {
@@ -253,7 +247,7 @@ PAA_LONG php_array_zval_to_long(zval *z) {
253
247
}
254
248
}
255
249
}
256
- PHP_ARRAY_FETCH_TYPE_MAP (PAA_LONG , long )
250
+ PHP_ARRAY_FETCH_TYPE_MAP (zend_long , long )
257
251
#define php_array_fetchc_long (zarr, litstr ) \
258
252
php_array_zval_to_long (php_array_fetchc(zarr, litstr))
259
253
@@ -454,20 +448,20 @@ zval *php_array_zval_to_object(zval *z, zend_class_entry *ce) {
454
448
*/
455
449
static inline
456
450
void php_array_unset(zval *zarr, const char *key) {
457
- PAA_SYM_DEL (Z_ARRVAL_P (zarr), key, PAA_LENGTH_ADJ ( strlen (key) ));
451
+ zend_symtable_str_del (Z_ARRVAL_P (zarr), key, strlen (key));
458
452
}
459
453
#define php_array_unsetl (zarr, key, len ) \
460
- PAA_SYM_DEL (Z_ARRVAL_P(zarr), key, PAA_LENGTH_ADJ( len) )
454
+ zend_symtable_str_del (Z_ARRVAL_P(zarr), key, len)
461
455
static inline
462
456
void php_array_unsetl_safe(zval *zarr, const char *key, int key_len) {
463
457
char *k = estrndup (key, key_len);
464
- PAA_SYM_DEL (Z_ARRVAL_P (zarr), k, PAA_LENGTH_ADJ ( key_len) );
458
+ zend_symtable_str_del (Z_ARRVAL_P (zarr), k, key_len);
465
459
efree (k);
466
460
}
467
461
#define php_array_unsetn (zarr, idx ) \
468
462
zend_symtable_index_del (Z_ARRVAL_P(zarr), idx)
469
463
#define php_array_unsetc (zarr, litstr ) \
470
- PAA_SYM_DEL (Z_ARRVAL_P(zarr), litstr, PAA_LENGTH_ADJ( sizeof (litstr) - 1) )
464
+ zend_symtable_str_del (Z_ARRVAL_P(zarr), litstr, sizeof(litstr) - 1)
471
465
static inline void php_array_unsetz(zval *zarr, zval *key) {
472
466
switch (Z_TYPE_P (key)) {
473
467
case IS_NULL:
0 commit comments