X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcontext.c;h=8fdbf22f41a2701b60833ce59407f3c48b078122;hp=46210f0659e2ce991cac079319e49d0f8001b894;hb=c0873cbbe9e5a83305adbc2bbd94aede5437f33d;hpb=682b684daaa140de059da4a060098b8a6c0a439e diff --git a/src/context.c b/src/context.c index 46210f0..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)) { @@ -324,7 +327,6 @@ void psi_context_free(struct psi_context **C) void psi_context_dump(struct psi_context *C, int fd) { size_t i; - struct psi_data *D; dprintf(fd, "// psi.engine=%s\n// %lu files\n", (char *) C->ops->query(C, PSI_CONTEXT_QUERY_SELF, NULL),