From 1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 14 Dec 2016 01:29:44 +0100 Subject: checksrc: warn for assignments within if() expressions ... they're already frowned upon in our source code style guide, this now enforces the rule harder. --- tests/unit/unit1305.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/unit/unit1305.c') diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c index 9af0727c3..db0a44c5f 100644 --- a/tests/unit/unit1305.c +++ b/tests/unit/unit1305.c @@ -80,15 +80,18 @@ static Curl_addrinfo *fake_ai(void) ss_size = sizeof(struct sockaddr_in); - if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) + ai = calloc(1, sizeof(Curl_addrinfo)); + if(!ai) return NULL; - if((ai->ai_canonname = strdup("dummy")) == NULL) { + ai->ai_canonname = strdup("dummy"); + if(!ai->ai_canonname) { free(ai); return NULL; } - if((ai->ai_addr = calloc(1, ss_size)) == NULL) { + ai->ai_addr = calloc(1, ss_size); + if(!ai->ai_addr) { free(ai->ai_canonname); free(ai); return NULL; -- cgit v1.2.3