X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.c;h=50bfa31d022e6ee8b4edf8c9b168f7278dbf99c6;hp=47b89cb615d3f3e40150eeb67afbba281a68330e;hb=216e7ac3b97aed5a5d65c511dc061c78be90e79d;hpb=2559f07a178b681dc240e20153ff5abdff54cb34 diff --git a/src/parser.c b/src/parser.c index 47b89cb..50bfa31 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Fri Nov 2 07:35:40 2018 */ +/* Generated by re2c 1.1.1 on Fri Nov 2 10:19:25 2018 */ #line 1 "src/parser.re" /******************************************************************************* Copyright (c) 2016, Michael Wallner . @@ -44,7 +44,7 @@ struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags) { if (!P) { - P = malloc(sizeof(*P)); + P = pemalloc(sizeof(*P), 1); } memset(P, 0, sizeof(*P)); @@ -52,8 +52,6 @@ struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, uns P->preproc = psi_cpp_init(P); - psi_cpp_load_defaults(P->preproc); - return P; } @@ -72,7 +70,7 @@ struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char * return NULL; } - if (!(fb = malloc(sizeof(*fb) + sb.st_size + YYMAXFILL))) { + if (!(fb = pemalloc(sizeof(*fb) + sb.st_size + YYMAXFILL, 1))) { if (report_errors) { P->error(PSI_DATA(P), NULL, PSI_WARNING, "Could not allocate %zu bytes for reading '%s': %s", @@ -112,7 +110,7 @@ struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char { struct psi_parser_input *sb; - if (!(sb = malloc(sizeof(*sb) + length + YYMAXFILL))) { + if (!(sb = pemalloc(sizeof(*sb) + length + YYMAXFILL, 1))) { P->error(PSI_DATA(P), NULL, PSI_WARNING, "Could not allocate %zu bytes: %s", length + YYMAXFILL, strerror(errno)); @@ -276,6 +274,8 @@ void psi_parser_free(struct psi_parser **P) } + + struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I) { struct psi_plist *tokens;