From: Dan Carpenter Date: Wed, 10 Oct 2012 06:30:27 +0000 (+0300) Subject: type: simplify get_binop_type() X-Git-Tag: 1.57~214 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/d6b4ff02202b5af6dc4ce4d315a080cc2e8c24ab type: simplify get_binop_type() Move a test for NULL a couple lines earlier. Signed-off-by: Dan Carpenter --- diff --git a/smatch_type.c b/smatch_type.c index 1de6073f..8e808a6b 100644 --- a/smatch_type.c +++ b/smatch_type.c @@ -31,14 +31,14 @@ static struct symbol *get_binop_type(struct expression *expr) left = get_type(expr->left); right = get_type(expr->right); - if (left && (left->type == SYM_PTR || left->type == SYM_ARRAY)) - return left; - if (right && (right->type == SYM_PTR || right->type == SYM_ARRAY)) - return right; - if (!left || !right) return NULL; + if (left->type == SYM_PTR || left->type == SYM_ARRAY) + return left; + if (right->type == SYM_PTR || right->type == SYM_ARRAY) + return right; + if (type_max(left) < type_max(&int_ctype) && type_max(right) < type_max(&int_ctype)) return &int_ctype;