diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-12-14 01:29:44 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-12-14 01:29:44 +0100 |
commit | 1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b (patch) | |
tree | c1606588aeae4535f0faa7942fcbe50e6e340f8b /tests/unit | |
parent | b228d2952b6762b5c9b851fba0cf391e80c6761a (diff) |
checksrc: warn for assignments within if() expressions
... they're already frowned upon in our source code style guide, this
now enforces the rule harder.
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/unit1305.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |