Lines Matching refs:c

42 	zend_constant *c = Z_PTR_P(zv);  in free_zend_constant()  local
44 if (!(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)) { in free_zend_constant()
45 zval_ptr_dtor_nogc(&c->value); in free_zend_constant()
46 if (c->name) { in free_zend_constant()
47 zend_string_release_ex(c->name, 0); in free_zend_constant()
49 efree(c); in free_zend_constant()
51 zval_internal_ptr_dtor(&c->value); in free_zend_constant()
52 if (c->name) { in free_zend_constant()
53 zend_string_release_ex(c->name, 1); in free_zend_constant()
55 free(c); in free_zend_constant()
63 zend_constant *c = Z_PTR_P(zv); in copy_zend_constant() local
65 ZEND_ASSERT(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in copy_zend_constant()
67 memcpy(Z_PTR_P(zv), c, sizeof(zend_constant)); in copy_zend_constant()
69 c = Z_PTR_P(zv); in copy_zend_constant()
70 c->name = zend_string_copy(c->name); in copy_zend_constant()
71 if (Z_TYPE(c->value) == IS_STRING) { in copy_zend_constant()
72 Z_STR(c->value) = zend_string_dup(Z_STR(c->value), 1); in copy_zend_constant()
86 zend_constant *c = (zend_constant *)Z_PTR_P(el); in clean_module_constant() local
89 if (ZEND_CONSTANT_MODULE_NUMBER(c) == module_number) { in clean_module_constant()
121 zend_constant c; in zend_register_null_constant() local
123 ZVAL_NULL(&c.value); in zend_register_null_constant()
124 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_null_constant()
125 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_null_constant()
126 zend_register_constant(&c); in zend_register_null_constant()
131 zend_constant c; in zend_register_bool_constant() local
133 ZVAL_BOOL(&c.value, bval); in zend_register_bool_constant()
134 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_bool_constant()
135 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_bool_constant()
136 zend_register_constant(&c); in zend_register_bool_constant()
141 zend_constant c; in zend_register_long_constant() local
143 ZVAL_LONG(&c.value, lval); in zend_register_long_constant()
144 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_long_constant()
145 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_long_constant()
146 zend_register_constant(&c); in zend_register_long_constant()
152 zend_constant c; in zend_register_double_constant() local
154 ZVAL_DOUBLE(&c.value, dval); in zend_register_double_constant()
155 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_double_constant()
156 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_double_constant()
157 zend_register_constant(&c); in zend_register_double_constant()
163 zend_constant c; in zend_register_stringl_constant() local
165 ZVAL_STR(&c.value, zend_string_init_interned(strval, strlen, flags & CONST_PERSISTENT)); in zend_register_stringl_constant()
166 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_stringl_constant()
167 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_stringl_constant()
168 zend_register_constant(&c); in zend_register_stringl_constant()
179 zend_constant *c; in zend_get_halt_offset_constant() local
195 c = zend_hash_find_ptr(EG(zend_constants), haltname); in zend_get_halt_offset_constant()
197 return c; in zend_get_halt_offset_constant()
234 ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ in zend_verify_const_access() argument
236 if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) { in zend_verify_const_access()
238 } else if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PRIVATE) { in zend_verify_const_access()
239 return (c->ce == scope); in zend_verify_const_access()
241 ZEND_ASSERT(ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PROTECTED); in zend_verify_const_access()
242 return zend_check_protected(c->ce, scope); in zend_verify_const_access()
249 zend_constant *c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len); in zend_get_constant_str_impl() local
250 if (c) { in zend_get_constant_str_impl()
251 return c; in zend_get_constant_str_impl()
254 c = zend_get_halt_offset_constant(name, name_len); in zend_get_constant_str_impl()
255 if (c) { in zend_get_constant_str_impl()
256 return c; in zend_get_constant_str_impl()
264 zend_constant *c = zend_get_constant_str_impl(name, name_len); in zend_get_constant_str() local
265 if (c) { in zend_get_constant_str()
266 return &c->value; in zend_get_constant_str()
273 zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name); in zend_get_constant_ptr() local
274 if (c) { in zend_get_constant_ptr()
275 return c; in zend_get_constant_ptr()
278 c = zend_get_halt_offset_constant(ZSTR_VAL(name), ZSTR_LEN(name)); in zend_get_constant_ptr()
279 if (c) { in zend_get_constant_ptr()
280 return c; in zend_get_constant_ptr()
288 zend_constant *c = zend_get_constant_ptr(name); in zend_get_constant() local
289 if (c) { in zend_get_constant()
290 return &c->value; in zend_get_constant()
298 zend_class_constant *c = NULL; in zend_get_class_constant_ex() local
332 c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), constant_name); in zend_get_class_constant_ex()
333 if (c == NULL) { in zend_get_class_constant_ex()
340 if (!zend_verify_const_access(c, scope)) { in zend_get_class_constant_ex()
342 …t access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(class_na… in zend_get_class_constant_ex()
355 if (UNEXPECTED(ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_DEPRECATED)) { in zend_get_class_constant_ex()
363 ret_constant = &c->value; in zend_get_class_constant_ex()
377 ret = zend_update_class_constant(c, constant_name, c->ce); in zend_get_class_constant_ex()
391 zend_constant *c; in zend_get_constant_ex() local
506 c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len); in zend_get_constant_ex()
509 if (!c) { in zend_get_constant_ex()
512 c = zend_get_constant_str_impl(constant_name, const_name_len); in zend_get_constant_ex()
517 c = zend_get_constant_ptr(cname); in zend_get_constant_ex()
519 c = zend_get_constant_str_impl(name, name_len); in zend_get_constant_ex()
523 if (!c) { in zend_get_constant_ex()
530 if (!(flags & ZEND_FETCH_CLASS_SILENT) && (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)) { in zend_get_constant_ex()
533 return &c->value; in zend_get_constant_ex()
536 static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c) in zend_hash_add_constant() argument
539 zend_constant *copy = pemalloc(sizeof(zend_constant), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_hash_add_constant()
541 memcpy(copy, c, sizeof(zend_constant)); in zend_hash_add_constant()
544 pefree(copy, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_hash_add_constant()
549 ZEND_API zend_result zend_register_constant(zend_constant *c) in zend_register_constant() argument
554 bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0; in zend_register_constant()
557 printf("Registering constant for module %d\n", c->module_number); in zend_register_constant()
560 const char *slash = strrchr(ZSTR_VAL(c->name), '\\'); in zend_register_constant()
562 lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), persistent); in zend_register_constant()
563 zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name)); in zend_register_constant()
567 name = c->name; in zend_register_constant()
573 || zend_hash_add_constant(EG(zend_constants), name, c) == NULL in zend_register_constant()
576 zend_string_release(c->name); in zend_register_constant()
578 zval_ptr_dtor_nogc(&c->value); in zend_register_constant()