X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.h;h=7aef5f53f907b87fd0298ea9b11e9275ff6104ec;hp=d4cfb225b8ffe8771aaa1b3a92b6a53d02fb55ad;hb=f24325648c601d4b0835074f271072f4832e4478;hpb=3d77b5b65efb78c1da9485dfde1fcd417066b803 diff --git a/src/parser.h b/src/parser.h index d4cfb22..7aef5f5 100644 --- a/src/parser.h +++ b/src/parser.h @@ -46,11 +46,21 @@ struct psi_parser { struct psi_parser_input { size_t length; - char *file; + zend_string *file; unsigned lines; char buffer[1]; }; +static inline void psi_parser_input_free(struct psi_parser_input **I) { + if (*I) { + struct psi_parser_input *i = *I; + + *I = NULL; + zend_string_release(i->file); + free(i); + } +} + struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags); struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char *filename, bool report_errors); struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char *string, size_t length);