[LTP] [PATCH v2 1/7] docparse: Implement #define and #include
Petr Vorel
pvorel@suse.cz
Tue Nov 2 15:54:50 CET 2021
Hi Cyril, Richie,
> Hi!
> > > +static void macro_get_string(FILE *f, char *buf, char *buf_end)
> > > +{
> > > + int c;
> > > +
> > > + for (;;) {
> > > + c = fgetc(f);
> > > +
> > > + switch (c) {
> > > + case '"':
> > Luckily there are no instances of '#define MACRO "...\"...\"..."' in LTP
> > AFAICT. Also there don't appear to be any '#define MACRO "..." \\n' that
> > we would care about.
Good catch!
Unless you send v3 feel free to add
Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Well I can fix that and add a test to to be sure.
Thanks!
...
> > > +static void macro_get_val(FILE *f, char *buf, size_t buf_len)
> > > +{
> > > + int c, prev = 0;
> > > + char *buf_end = buf + buf_len - 1;
> > > +
> > > + c = fgetc(f);
> > > + if (c == '"') {
> > I guess this could be whitespace unless scanf slurps any trailing
> > whitespace?
> The scanf does not slurp any trainling whitespaces, so this should be
> fixed by:
> while (isspace(c = fgetc(f)));
> With that we get slightly better output, so I will add that before
> applying.
+1
Kind regards,
Petr
More information about the ltp
mailing list