From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 6/6] wstring: call is_string_type() only when needed
Date: Sat, 8 Aug 2020 18:11:43 +0200 [thread overview]
Message-ID: <20200808161143.28272-7-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200808161143.28272-1-luc.vanoostenryck@gmail.com>
Just a tiny code reorganization to call is_string_type()
only where & when needed.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
evaluate.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/evaluate.c b/evaluate.c
index 8d09c560e7fe..d2cf1c0ae3f8 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2764,7 +2764,6 @@ static struct expression *handle_scalar(struct expression *e, int nested)
static int handle_initializer(struct expression **ep, int nested,
int class, struct symbol *ctype, unsigned long mods)
{
- int is_string = is_string_type(ctype);
struct expression *e = *ep, *p;
struct symbol *type;
@@ -2798,7 +2797,7 @@ static int handle_initializer(struct expression **ep, int nested,
* pathologies, so we don't need anything fancy here.
*/
if (e->type == EXPR_INITIALIZER) {
- if (is_string) {
+ if (is_string_type(ctype)) {
struct expression *v = NULL;
int count = 0;
@@ -2819,7 +2818,7 @@ static int handle_initializer(struct expression **ep, int nested,
/* string */
if (is_string_literal(&e)) {
/* either we are doing array of char, or we'll have to dig in */
- if (is_string) {
+ if (is_string_type(ctype)) {
*ep = e;
goto String;
}
--
2.28.0
prev parent reply other threads:[~2020-08-08 16:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-08 16:11 [PATCH 0/6] teach sparse about wide string initializers Luc Van Oostenryck
2020-08-08 16:11 ` [PATCH 1/6] wstring: add support for evaluation of wide string Luc Van Oostenryck
2020-08-08 16:11 ` [PATCH 2/6] wstring: add support for checking size in string initializer Luc Van Oostenryck
2020-08-08 16:11 ` [PATCH 3/6] wstring: add support for examination of string initialization Luc Van Oostenryck
2020-08-08 16:11 ` [PATCH 4/6] wstring: add helper is_wchar_type() Luc Van Oostenryck
2020-08-08 16:11 ` [PATCH 5/6] wstring: extend is_string_type() to also detect wide strings Luc Van Oostenryck
2020-08-08 16:11 ` Luc Van Oostenryck [this message]
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=20200808161143.28272-7-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).