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. --- docs/examples/curlx.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'docs/examples/curlx.c') diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c index 3b11ef737..cd1677af3 100644 --- a/docs/examples/curlx.c +++ b/docs/examples/curlx.c @@ -200,7 +200,8 @@ static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg) if(p->verbose > 1) X509_print_ex(p->errorbio, ctx->cert, 0, 0); - if(accessinfo = my_get_ext(ctx->cert, p->accesstype, NID_sinfo_access)) { + accessinfo = my_get_ext(ctx->cert, p->accesstype, NID_sinfo_access); + if(accessinfo) { if(p->verbose) BIO_printf(p->errorbio, "Setting URL from SIA to: %s\n", accessinfo); @@ -355,7 +356,8 @@ int main(int argc, char **argv) } else if(strcmp(*args, "-accesstype") == 0) { if(args[1]) { - if((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0))) == 0) + p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0)); + if(p.accesstype == 0) badarg=1; } else @@ -410,16 +412,19 @@ int main(int argc, char **argv) p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE); - if(!(p.curl = curl_easy_init())) { + p.curl = curl_easy_init(); + if(!p.curl) { BIO_printf(p.errorbio, "Cannot init curl lib\n"); goto err; } - if(!(p12bio = BIO_new_file(p.p12file, "rb"))) { + p12bio = BIO_new_file(p.p12file, "rb"); + if(!p12bio) { BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file); goto err; } - if(!(p.p12 = d2i_PKCS12_bio(p12bio, NULL))) { + p.p12 = d2i_PKCS12_bio(p12bio, NULL); + if(!p.p12) { BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); goto err; } @@ -447,16 +452,19 @@ int main(int argc, char **argv) } else if(p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */ - if(!(serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access))) { + serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access); + if(!serverurl) { int j=0; BIO_printf(p.errorbio, "no service URL in user cert " "cherching in others certificats\n"); for(j=0; j