Lines Matching refs:c

38 	zend_constant *c = Z_PTR_P(zv);  in free_zend_constant()  local
40 if (!(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)) { in free_zend_constant()
41 zval_ptr_dtor_nogc(&c->value); in free_zend_constant()
42 if (c->name) { in free_zend_constant()
43 zend_string_release_ex(c->name, 0); in free_zend_constant()
45 efree(c); in free_zend_constant()
47 zval_internal_ptr_dtor(&c->value); in free_zend_constant()
48 if (c->name) { in free_zend_constant()
49 zend_string_release_ex(c->name, 1); in free_zend_constant()
51 free(c); in free_zend_constant()
59 zend_constant *c = Z_PTR_P(zv); in copy_zend_constant() local
61 ZEND_ASSERT(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in copy_zend_constant()
63 memcpy(Z_PTR_P(zv), c, sizeof(zend_constant)); in copy_zend_constant()
65 c = Z_PTR_P(zv); in copy_zend_constant()
66 c->name = zend_string_copy(c->name); in copy_zend_constant()
67 if (Z_TYPE(c->value) == IS_STRING) { in copy_zend_constant()
68 Z_STR(c->value) = zend_string_dup(Z_STR(c->value), 1); in copy_zend_constant()
82 zend_constant *c = (zend_constant *)Z_PTR_P(el); in clean_module_constant() local
85 if (ZEND_CONSTANT_MODULE_NUMBER(c) == module_number) { in clean_module_constant()
151 zend_constant c; in zend_register_null_constant() local
153 ZVAL_NULL(&c.value); in zend_register_null_constant()
154 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_null_constant()
155 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_null_constant()
156 zend_register_constant(&c); in zend_register_null_constant()
161 zend_constant c; in zend_register_bool_constant() local
163 ZVAL_BOOL(&c.value, bval); in zend_register_bool_constant()
164 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_bool_constant()
165 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_bool_constant()
166 zend_register_constant(&c); in zend_register_bool_constant()
171 zend_constant c; in zend_register_long_constant() local
173 ZVAL_LONG(&c.value, lval); in zend_register_long_constant()
174 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_long_constant()
175 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_long_constant()
176 zend_register_constant(&c); in zend_register_long_constant()
182 zend_constant c; in zend_register_double_constant() local
184 ZVAL_DOUBLE(&c.value, dval); in zend_register_double_constant()
185 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_double_constant()
186 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_double_constant()
187 zend_register_constant(&c); in zend_register_double_constant()
193 zend_constant c; in zend_register_stringl_constant() local
195 ZVAL_STR(&c.value, zend_string_init_interned(strval, strlen, flags & CONST_PERSISTENT)); in zend_register_stringl_constant()
196 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_stringl_constant()
197 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_stringl_constant()
198 zend_register_constant(&c); in zend_register_stringl_constant()
209 zend_constant *c; in zend_get_special_constant() local
225 c = zend_hash_find_ptr(EG(zend_constants), haltname); in zend_get_special_constant()
227 return c; in zend_get_special_constant()
233 ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ in zend_verify_const_access() argument
235 if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) { in zend_verify_const_access()
237 } else if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PRIVATE) { in zend_verify_const_access()
238 return (c->ce == scope); in zend_verify_const_access()
240 ZEND_ASSERT(Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PROTECTED); in zend_verify_const_access()
241 return zend_check_protected(c->ce, scope); in zend_verify_const_access()
248 zend_constant *c; in zend_get_constant_str_impl() local
251 if ((c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len)) == NULL) { in zend_get_constant_str_impl()
254 if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name_len)) != NULL) { in zend_get_constant_str_impl()
255 if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) { in zend_get_constant_str_impl()
256 c = NULL; in zend_get_constant_str_impl()
259 c = zend_get_special_constant(name, name_len); in zend_get_constant_str_impl()
264 return c; in zend_get_constant_str_impl()
269 zend_constant *c = zend_get_constant_str_impl(name, name_len); in zend_get_constant_str() local
270 return c ? &c->value : NULL; in zend_get_constant_str()
276 zend_constant *c; in zend_get_constant_impl() local
285 c = Z_PTR_P(zv); in zend_get_constant_impl()
286 if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) { in zend_get_constant_impl()
287 c = NULL; in zend_get_constant_impl()
290 c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name)); in zend_get_constant_impl()
293 return c; in zend_get_constant_impl()
301 zend_constant *c = zend_get_constant_impl(name); in zend_get_constant() local
302 return c ? &c->value : NULL; in zend_get_constant()
305 static zend_bool is_access_deprecated(const zend_constant *c, const char *access_name) { in is_access_deprecated() argument
306 const char *ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name)); in is_access_deprecated()
309 size_t shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1; in is_access_deprecated()
310 size_t shortname_len = ZSTR_LEN(c->name) - shortname_offset; in is_access_deprecated()
313 ZSTR_VAL(c->name) + shortname_offset, in is_access_deprecated()
318 return memcmp(access_name, ZSTR_VAL(c->name), ZSTR_LEN(c->name)) != 0; in is_access_deprecated()
324 zend_constant *c; in zend_get_constant_ex() local
343 zend_class_constant *c = NULL; in zend_get_constant_ex() local
372 c = zend_hash_find_ptr(&ce->constants_table, constant_name); in zend_get_constant_ex()
373 if (c == NULL) { in zend_get_constant_ex()
380 if (!zend_verify_const_access(c, scope)) { in zend_get_constant_ex()
382 …ULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(c… in zend_get_constant_ex()
386 ret_constant = &c->value; in zend_get_constant_ex()
400 ret = zval_update_constant_ex(ret_constant, c->ce); in zend_get_constant_ex()
432 if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) == NULL) { in zend_get_constant_ex()
435 if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) != NULL) { in zend_get_constant_ex()
436 if ((ZEND_CONSTANT_FLAGS(c) & CONST_CS) != 0) { in zend_get_constant_ex()
437 c = NULL; in zend_get_constant_ex()
443 if (!c) { in zend_get_constant_ex()
449 c = zend_get_constant_str_impl(constant_name, const_name_len); in zend_get_constant_ex()
454 c = zend_get_constant_impl(cname); in zend_get_constant_ex()
456 c = zend_get_constant_str_impl(name, name_len); in zend_get_constant_ex()
460 if (!c) { in zend_get_constant_ex()
465 if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST)) && is_access_deprecated(c, name)) { in zend_get_constant_ex()
469 ZSTR_VAL(c->name)); in zend_get_constant_ex()
473 return &c->value; in zend_get_constant_ex()
476 static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c) in zend_hash_add_constant() argument
479 zend_constant *copy = pemalloc(sizeof(zend_constant), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_hash_add_constant()
481 memcpy(copy, c, sizeof(zend_constant)); in zend_hash_add_constant()
484 pefree(copy, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_hash_add_constant()
489 ZEND_API int zend_register_constant(zend_constant *c) in zend_register_constant() argument
496 printf("Registering constant for module %d\n", c->module_number); in zend_register_constant()
499 if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CS)) { in zend_register_constant()
500 lowercase_name = zend_string_tolower_ex(c->name, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_register_constant()
504 char *slash = strrchr(ZSTR_VAL(c->name), '\\'); in zend_register_constant()
506 …lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), ZEND_CONSTANT_FLAGS(c) & C… in zend_register_constant()
507 zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name)); in zend_register_constant()
511 name = c->name; in zend_register_constant()
517 || zend_hash_add_constant(EG(zend_constants), name, c) == NULL) { in zend_register_constant()
520 if (ZSTR_VAL(c->name)[0] == '\0' && ZSTR_LEN(c->name) > sizeof("\0__COMPILER_HALT_OFFSET__")-1 in zend_register_constant()
524 zend_string_release(c->name); in zend_register_constant()
525 if (!(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)) { in zend_register_constant()
526 zval_ptr_dtor_nogc(&c->value); in zend_register_constant()