X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcontext.c;h=8fdbf22f41a2701b60833ce59407f3c48b078122;hp=abe1ff64c79ade60197d11f26d34c2b462976f8f;hb=c0873cbbe9e5a83305adbc2bbd94aede5437f33d;hpb=413894839b41982ee7bb35be929cbf4431148f16 diff --git a/src/context.c b/src/context.c index abe1ff6..8fdbf22 100644 --- a/src/context.c +++ b/src/context.c @@ -142,7 +142,7 @@ void psi_context_build(struct psi_context *C, const char *paths) psi_parser_parse(&P, I); psi_context_add(C, &P); psi_parser_dtor(&P); - free(I); + psi_parser_input_free(&I); } } @@ -176,11 +176,11 @@ zend_function_entry *psi_context_compile(struct psi_context *C) while (psi_plist_get(C->consts, i++, &c)) { - if (zend_get_constant_str(c->name, strlen(c->name))) { + if (zend_get_constant(c->name)) { continue; } - zc.name = zend_string_init(c->name, strlen(c->name), 1); + zc.name = zend_string_copy(c->name); switch (c->type->type) { case PSI_T_BOOL: @@ -196,6 +196,9 @@ zend_function_entry *psi_context_compile(struct psi_context *C) case PSI_T_STRING: case PSI_T_QUOTED_STRING: ZVAL_NEW_STR(&zc.value, zend_string_copy(c->val->ival.zend.str)); + if (ZSTR_IS_INTERNED(Z_STR(zc.value))) { + Z_TYPE_FLAGS(zc.value) = 0; + } break; default: assert(0); @@ -218,9 +221,9 @@ zend_function_entry *psi_context_compile(struct psi_context *C) zend_string *name; if (psi_decl_type_is_anon(e->name, "enum")) { - name = strpprintf(0, "psi\\%s", item->name); + name = strpprintf(0, "psi\\%s", item->name->val); } else { - name = strpprintf(0, "psi\\%s\\%s", e->name, item->name); + name = strpprintf(0, "psi\\%s\\%s", e->name->val, item->name->val); } if (zend_get_constant(name)) {