All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Richard Palethorpe <rpalethorpe@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/7] docparse: Implement #define and #include
Date: Tue, 2 Nov 2021 12:21:26 +0100	[thread overview]
Message-ID: <YYEfNvjosOzWzKRJ@yuki> (raw)
In-Reply-To: <871r3yq0hm.fsf@suse.de>

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.

Well I can fix that and add a test to to be sure.

> > +		case EOF:
> > +			*buf = 0;
> > +			return;
> > +		default:
> > +			if (buf < buf_end)
> > +				*(buf++) = c;
> > +		}
> > +	}
> > +}
> > +
> > +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.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2021-11-02 11:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 14:53 [LTP] [PATCH v2 0/7] docparse improvements Cyril Hrubis
2021-11-01 14:53 ` [LTP] [PATCH v2 1/7] docparse: Implement #define and #include Cyril Hrubis
2021-11-02 10:05   ` Richard Palethorpe
2021-11-02 11:21     ` Cyril Hrubis [this message]
2021-11-02 14:54       ` Petr Vorel
2021-11-02 15:10         ` Cyril Hrubis
2021-11-02 15:38           ` Petr Vorel
2021-11-03  9:08           ` Richard Palethorpe
2021-11-01 14:53 ` [LTP] [PATCH v2 2/7] docparse: Add tests Cyril Hrubis
2021-11-02 11:09   ` Richard Palethorpe
2021-11-01 14:53 ` [LTP] [PATCH v2 3/7] docparse: data_storage: Add integer type node Cyril Hrubis
2021-11-02 11:14   ` Richard Palethorpe
2021-11-01 14:53 ` [LTP] [PATCH v2 4/7] docparse: Implement ARRAY_SIZE() Cyril Hrubis
2021-11-02 11:39   ` Richard Palethorpe
2021-11-02 12:07     ` Cyril Hrubis
2021-11-01 14:53 ` [LTP] [PATCH v2 5/7] docparse: Add type normalization Cyril Hrubis
2021-11-02 11:52   ` Richard Palethorpe
2021-11-02 12:06     ` Cyril Hrubis
2021-11-01 14:53 ` [LTP] [PATCH v2 6/7] docparse: Group data to 'testsuite' and 'defaults' Cyril Hrubis
2021-11-01 14:53 ` [LTP] [PATCH v2 7/7] docparse: Split into metadata and docparse Cyril Hrubis
2021-11-01 15:14   ` Cyril Hrubis
2021-11-02 15:22   ` Petr Vorel
2021-11-02 15:28     ` Cyril Hrubis
2021-11-02 15:39       ` Petr Vorel
2021-11-02 16:04         ` Cyril Hrubis
2021-11-03 11:39           ` Cyril Hrubis
2021-11-01 14:55 ` [LTP] [PATCH v2 0/7] docparse improvements Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYEfNvjosOzWzKRJ@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.