void psi_data_dump(int fd, struct psi_data *D)
{
+ size_t i = 0;
+ char *libname;
+
if (D->file.filename) {
size_t i = 0;
char *libname;
dprintf(fd, "// filename=%s (%u errors)\n", D->file.filename, D->errors);
- while (psi_plist_get(D->file.libnames, i++, &libname)) {
- dprintf(fd, "lib \"%s\";\n", libname);
- }
- } else {
- dprintf(fd, "// builtin predef\n");
+ }
+ while (psi_plist_get(D->file.libnames, i++, &libname)) {
+ dprintf(fd, "lib \"%s\";\n", libname);
}
if (psi_plist_count(D->types)) {
size_t i = 0;
while (psi_plist_get(D->decls, i++, &decl)) {
psi_decl_dump(fd, decl);
- dprintf(fd, "\n");
+ dprintf(fd, "// %p \n", decl->sym);
}
dprintf(fd, "\n");
}
-/* Generated by re2c 1.0.3 on Wed Apr 18 08:03:43 2018 */
+/* Generated by re2c 1.0.3 on Wed Apr 18 08:08:41 2018 */
#line 1 "src/parser.re"
/*******************************************************************************
Copyright (c) 2016, Michael Wallner <mike@php.net>.
return false;
}
- libname = strdup(libname);
dst->file.libnames = psi_plist_add(dst->file.libnames, &libname);
dst->file.dlopened = psi_plist_add(dst->file.dlopened, &dlopened);
}
psi_validate_list(scope, dst, &consts, psi_validate_const);
psi_validate_list(scope, dst, &impls, psi_validate_impl);
+ if (types.cur != types.src) {
+ psi_plist_free(types.cur);
+ }
+ if (structs.cur != structs.src) {
+ psi_plist_free(structs.cur);
+ }
+ if (unions.cur != unions.src) {
+ psi_plist_free(unions.cur);
+ }
+ if (enums.cur != enums.src) {
+ psi_plist_free(enums.cur);
+ }
+ if (vars.cur != vars.src) {
+ psi_plist_free(vars.cur);
+ }
+ if (decls.cur != decls.src) {
+ psi_plist_free(decls.cur);
+ }
+ if (consts.cur != consts.src) {
+ psi_plist_free(consts.cur);
+ }
+ if (impls.cur != impls.src) {
+ psi_plist_free(impls.cur);
+ }
+
return true;
}