static inline zend_constant *zend_get_constant_impl(zend_string *name) { zval *zv; zend_constant *c; ALLOCA_FLAG(use_heap) zv = zend_hash_find(EG(zend_constants), name); if (zv == NULL) { char *lcname = do_alloca(ZSTR_LEN(name) + 1, use_heap); zend_str_tolower_copy(lcname, ZSTR_VAL(name), ZSTR_LEN(name)); zv = zend_hash_str_find(EG(zend_constants), lcname, ZSTR_LEN(name)); if (zv != NULL) { c = Z_PTR_P(zv); if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) { c = NULL; } } else { c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name)); } free_alloca(lcname, use_heap); return c; } else { return (zend_constant *) Z_PTR_P(zv); } }
ZEND_API zval *zend_get_constant(zend_string *name) { zval *zv; zend_constant *c; ALLOCA_FLAG(use_heap) zv = zend_hash_find(EG(zend_constants), name); if (zv == NULL) { char *lcname = do_alloca(ZSTR_LEN(name) + 1, use_heap); zend_str_tolower_copy(lcname, ZSTR_VAL(name), ZSTR_LEN(name)); zv = zend_hash_str_find(EG(zend_constants), lcname, ZSTR_LEN(name)); if (zv != NULL) { c = Z_PTR_P(zv); if (c->flags & CONST_CS) { c = NULL; } } else { c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name)); } free_alloca(lcname, use_heap); return c ? &c->value : NULL; } else { return &((zend_constant*)Z_PTR_P(zv))->value; } }
ZEND_API zval *zend_get_constant(zend_string *name) { zend_constant *c; ALLOCA_FLAG(use_heap) if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) { char *lcname = do_alloca(name->len + 1, use_heap); zend_str_tolower_copy(lcname, name->val, name->len); if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name->len)) != NULL) { if (c->flags & CONST_CS) { c = NULL; } } else { c = zend_get_special_constant(name->val, name->len); } free_alloca(lcname, use_heap); } return c ? &c->value : NULL; }
static inline zend_constant *zend_get_constant_str_impl(const char *name, size_t name_len) { zend_constant *c; ALLOCA_FLAG(use_heap) if ((c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len)) == NULL) { char *lcname = do_alloca(name_len + 1, use_heap); zend_str_tolower_copy(lcname, name, name_len); if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name_len)) != NULL) { if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) { c = NULL; } } else { c = zend_get_special_constant(name, name_len); } free_alloca(lcname, use_heap); } return c; }