diff mbox series

[6/6] wstring: call is_string_type() only when needed

Message ID 20200808161143.28272-7-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series teach sparse about wide string initializers | expand

Commit Message

Luc Van Oostenryck Aug. 8, 2020, 4:11 p.m. UTC
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 mbox series

Patch

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;
 		}