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()
138 zend_constant c; in zend_register_null_constant() local
140 ZVAL_NULL(&c.value); in zend_register_null_constant()
141 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_null_constant()
142 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_null_constant()
143 zend_register_constant(&c); in zend_register_null_constant()
148 zend_constant c; in zend_register_bool_constant() local
150 ZVAL_BOOL(&c.value, bval); in zend_register_bool_constant()
151 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_bool_constant()
152 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_bool_constant()
153 zend_register_constant(&c); in zend_register_bool_constant()
158 zend_constant c; in zend_register_long_constant() local
160 ZVAL_LONG(&c.value, lval); in zend_register_long_constant()
161 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_long_constant()
162 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_long_constant()
163 zend_register_constant(&c); in zend_register_long_constant()
169 zend_constant c; in zend_register_double_constant() local
171 ZVAL_DOUBLE(&c.value, dval); in zend_register_double_constant()
172 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_double_constant()
173 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_double_constant()
174 zend_register_constant(&c); in zend_register_double_constant()
180 zend_constant c; in zend_register_stringl_constant() local
182 ZVAL_STR(&c.value, zend_string_init_interned(strval, strlen, flags & CONST_PERSISTENT)); in zend_register_stringl_constant()
183 ZEND_CONSTANT_SET_FLAGS(&c, flags, module_number); in zend_register_stringl_constant()
184 c.name = zend_string_init_interned(name, name_len, flags & CONST_PERSISTENT); in zend_register_stringl_constant()
185 zend_register_constant(&c); in zend_register_stringl_constant()
196 zend_constant *c; in zend_get_halt_offset_constant() local
212 c = zend_hash_find_ptr(EG(zend_constants), haltname); in zend_get_halt_offset_constant()
214 return c; in zend_get_halt_offset_constant()
251 ZEND_API bool zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ in zend_verify_const_access() argument
253 if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PUBLIC) { in zend_verify_const_access()
255 } else if (ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PRIVATE) { in zend_verify_const_access()
256 return (c->ce == scope); in zend_verify_const_access()
258 ZEND_ASSERT(ZEND_CLASS_CONST_FLAGS(c) & ZEND_ACC_PROTECTED); in zend_verify_const_access()
259 return zend_check_protected(c->ce, scope); in zend_verify_const_access()
266 zend_constant *c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len); in zend_get_constant_str_impl() local
267 if (c) { in zend_get_constant_str_impl()
268 return c; in zend_get_constant_str_impl()
271 c = zend_get_halt_offset_constant(name, name_len); in zend_get_constant_str_impl()
272 if (c) { in zend_get_constant_str_impl()
273 return c; in zend_get_constant_str_impl()
281 zend_constant *c = zend_get_constant_str_impl(name, name_len); in zend_get_constant_str() local
282 if (c) { in zend_get_constant_str()
283 return &c->value; in zend_get_constant_str()
290 zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name); in zend_get_constant_impl() local
291 if (c) { in zend_get_constant_impl()
292 return c; in zend_get_constant_impl()
295 c = zend_get_halt_offset_constant(ZSTR_VAL(name), ZSTR_LEN(name)); in zend_get_constant_impl()
296 if (c) { in zend_get_constant_impl()
297 return c; in zend_get_constant_impl()
305 zend_constant *c = zend_get_constant_impl(name); in zend_get_constant() local
306 if (c) { in zend_get_constant()
307 return &c->value; in zend_get_constant()
315 zend_class_constant *c = NULL; in zend_get_class_constant_ex() local
349 c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), constant_name); in zend_get_class_constant_ex()
350 if (c == NULL) { in zend_get_class_constant_ex()
357 if (!zend_verify_const_access(c, scope)) { in zend_get_class_constant_ex()
359 …t access %s constant %s::%s", zend_visibility_string(ZEND_CLASS_CONST_FLAGS(c)), ZSTR_VAL(class_na… in zend_get_class_constant_ex()
372 ret_constant = &c->value; in zend_get_class_constant_ex()
386 ret = zval_update_constant_ex(ret_constant, c->ce); in zend_get_class_constant_ex()
400 zend_constant *c; in zend_get_constant_ex() local
515 c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len); in zend_get_constant_ex()
518 if (!c) { in zend_get_constant_ex()
521 c = zend_get_constant_str_impl(constant_name, const_name_len); in zend_get_constant_ex()
526 c = zend_get_constant_impl(cname); in zend_get_constant_ex()
528 c = zend_get_constant_str_impl(name, name_len); in zend_get_constant_ex()
532 if (!c) { in zend_get_constant_ex()
539 if (!(flags & ZEND_FETCH_CLASS_SILENT) && (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)) { in zend_get_constant_ex()
542 return &c->value; in zend_get_constant_ex()
545 static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c) in zend_hash_add_constant() argument
548 zend_constant *copy = pemalloc(sizeof(zend_constant), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_hash_add_constant()
550 memcpy(copy, c, sizeof(zend_constant)); in zend_hash_add_constant()
553 pefree(copy, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); in zend_hash_add_constant()
558 ZEND_API zend_result zend_register_constant(zend_constant *c) in zend_register_constant() argument
563 bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0; in zend_register_constant()
566 printf("Registering constant for module %d\n", c->module_number); in zend_register_constant()
569 const char *slash = strrchr(ZSTR_VAL(c->name), '\\'); in zend_register_constant()
571 lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), persistent); in zend_register_constant()
572 zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name)); in zend_register_constant()
576 name = c->name; in zend_register_constant()
582 || zend_hash_add_constant(EG(zend_constants), name, c) == NULL in zend_register_constant()
585 zend_string_release(c->name); in zend_register_constant()
587 zval_ptr_dtor_nogc(&c->value); in zend_register_constant()