From 298b86e01b6b733a53493e31520893014856d5d0 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 11 Jan 2018 15:26:37 +0300 Subject: [PATCH] constraints: cleanup unmet_constraint() This was from before Christmas. I'm sure it's an improvement but I don't see a bug. I guess it's a cleanup. Signed-off-by: Dan Carpenter --- smatch_constraints.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/smatch_constraints.c b/smatch_constraints.c index 3453b0e9..7a4502f3 100644 --- a/smatch_constraints.c +++ b/smatch_constraints.c @@ -296,12 +296,6 @@ char *unmet_constraint(struct expression *data, struct expression *offset) char *data_str; char *required; int req_op; - int found = 0; - - state = get_state_expr(my_id, offset); - if (!state) - return NULL; - list = state->data; data_str = get_constraint_str(data); if (!data_str) @@ -309,7 +303,12 @@ char *unmet_constraint(struct expression *data, struct expression *offset) required = get_required_constraint(data_str); if (!required) - return NULL; + goto free_data; + + state = get_state_expr(my_id, offset); + if (!state) + goto free_data; + list = state->data; /* check the list of bounds on our index against the list that work */ FOR_EACH_PTR(list, con) { @@ -326,16 +325,13 @@ char *unmet_constraint(struct expression *data, struct expression *offset) if (!req_op) continue; if (con->op == '<' || con->op == req_op) { - found = 1; + free_string(required); + required = NULL; goto free_data; } } END_FOR_EACH_PTR(con); free_data: - if (found) { - free_string(required); - required = NULL; - } free_string(data_str); return required; } -- 2.11.4.GIT