X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcontext.c;h=161534e9f8aa03a180fc0866dec74d03e8bb7aba;hp=199f533317ed7dfce6981ec01778a3fdfd819511;hb=42f44eb5bf4ecd36e26e051fada79d861d0f92d2;hpb=1b6db76e3005344b33ab45b00e7e61386a33932a diff --git a/src/context.c b/src/context.c index 199f533..161534e 100644 --- a/src/context.c +++ b/src/context.c @@ -240,6 +240,7 @@ void psi_context_build(struct psi_context *C, const char *paths) for (i = 0; i < n; ++i) { char psi[MAXPATHLEN]; struct psi_parser P; + struct psi_parser_input *I; if (MAXPATHLEN <= slprintf(psi, MAXPATHLEN, "%s/%s", ptr, entries[i]->d_name)) { C->error(PSI_DATA(C), NULL, PSI_WARNING, "Path to PSI file too long: %s/%s", @@ -250,15 +251,15 @@ void psi_context_build(struct psi_context *C, const char *paths) psi, strerror(errno)); continue; } - if (!psi_parser_open_file(&P, psi)) { + if (!(I = psi_parser_open_file(&P, psi, true))) { C->error(PSI_DATA(C), NULL, PSI_WARNING, "Failed to open PSI file (%s): %s", psi, strerror(errno)); continue; } - - psi_parser_parse(&P); + psi_parser_parse(&P, I); psi_context_add_data(C, PSI_DATA(&P)); psi_parser_dtor(&P); + free(I); } }