From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/2] lib: Add generic boolean expression parser and eval
Date: Tue, 3 Nov 2020 14:10:43 +0100 [thread overview]
Message-ID: <20201103131043.GB8061@yuki.lan> (raw)
In-Reply-To: <87blge62vs.fsf@suse.de>
Hi!
> > +struct tst_expr {
> > + struct tst_expr_tok *expr;
>
> Maybe call this 'first' or 'head'?
>
> > + struct tst_expr_tok *buf;
>
> I suppose that buf could be a trailing array saving a call to malloc and
> free :-)
Good point I do not know how I missed the simplest solution here.
> > + if (!check_two(expr->buf[cnt-1].op)) {
> > + expr->buf[cnt-1].priv = "Unfinished expression";
> > + goto err;
> > + }
>
> This looks a bit odd as it is the only place you use buf like this. Why
> not only use buf until setting expr=out[0] (and only set buf=tok
> initially) or only use expr until free(expr->buf) and/or do --i and use
> that?
I guess that makes sense. I will changed that anyways if I convert the
structure to a trailing array.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2020-11-03 13:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 11:38 [LTP] [PATCH v3 0/2] Add support for kconfig constraints Cyril Hrubis
2020-11-03 11:38 ` [LTP] [PATCH v3 1/2] lib: Add generic boolean expression parser and eval Cyril Hrubis
2020-11-03 12:28 ` Richard Palethorpe
2020-11-03 13:10 ` Cyril Hrubis [this message]
2020-11-03 11:38 ` [LTP] [PATCH v3 2/2] lib/tst_kconfig: Make use of boolean expression eval 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=20201103131043.GB8061@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox