From fd4b0c0832044cc10031cdb2abf656980fbf8eb1 Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Thu, 28 Jul 2016 22:51:18 +0200 Subject: [PATCH] Fix some style issues Reviewed-by: Richard Levitte Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1342) --- apps/speed.c | 85 ++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/apps/speed.c b/apps/speed.c index 5b3db90cd6..50ae64ae6d 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -1075,8 +1075,7 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ int job_op_count = 0; int total_op_count = 0; int num_inprogress = 0; - int error = 0; - int i = 0; + int error = 0, i = 0, async = 0; OSSL_ASYNC_FD job_fd = 0; size_t num_job_fds = 0; @@ -1086,27 +1085,27 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ return loop_function((void *)loopargs); } - for (i = 0; i < async_jobs && !error; i++) { - switch (ASYNC_start_job(&(loopargs[i].inprogress_job), loopargs[i].wait_ctx, + async = ASYNC_start_job(&(loopargs[i].inprogress_job), loopargs[i].wait_ctx, &job_op_count, loop_function, - (void *)(loopargs + i), sizeof(loopargs_t))) { - case ASYNC_PAUSE: - ++num_inprogress; - break; - case ASYNC_FINISH: - if (job_op_count == -1) { - error = 1; - } else { - total_op_count += job_op_count; - } - break; - case ASYNC_NO_JOBS: - case ASYNC_ERR: - BIO_printf(bio_err, "Failure in the job\n"); - ERR_print_errors(bio_err); + (void *)(loopargs + i), sizeof(loopargs_t)); + switch (async) { + case ASYNC_PAUSE: + ++num_inprogress; + break; + case ASYNC_FINISH: + if (job_op_count == -1) { error = 1; - break; + } else { + total_op_count += job_op_count; + } + break; + case ASYNC_NO_JOBS: + case ASYNC_ERR: + BIO_printf(bio_err, "Failure in the job\n"); + ERR_print_errors(bio_err); + error = 1; + break; } } @@ -1179,33 +1178,35 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_ if (num_job_fds == 1 && !FD_ISSET(job_fd, &waitfdset)) continue; #elif defined(OPENSSL_SYS_WINDOWS) - if (num_job_fds == 1 && - !PeekNamedPipe(job_fd, NULL, 0, NULL, &avail, NULL) && avail > 0) + if (num_job_fds == 1 + && !PeekNamedPipe(job_fd, NULL, 0, NULL, &avail, NULL) + && avail > 0) continue; #endif - switch (ASYNC_start_job(&(loopargs[i].inprogress_job), loopargs[i].wait_ctx, + async = ASYNC_start_job(&(loopargs[i].inprogress_job), loopargs[i].wait_ctx, &job_op_count, loop_function, (void *)(loopargs + i), - sizeof(loopargs_t))) { - case ASYNC_PAUSE: - break; - case ASYNC_FINISH: - if (job_op_count == -1) { - error = 1; - } else { - total_op_count += job_op_count; - } - --num_inprogress; - loopargs[i].inprogress_job = NULL; - break; - case ASYNC_NO_JOBS: - case ASYNC_ERR: - --num_inprogress; - loopargs[i].inprogress_job = NULL; - BIO_printf(bio_err, "Failure in the job\n"); - ERR_print_errors(bio_err); + sizeof(loopargs_t)); + switch (async) { + case ASYNC_PAUSE: + break; + case ASYNC_FINISH: + if (job_op_count == -1) { error = 1; - break; + } else { + total_op_count += job_op_count; + } + --num_inprogress; + loopargs[i].inprogress_job = NULL; + break; + case ASYNC_NO_JOBS: + case ASYNC_ERR: + --num_inprogress; + loopargs[i].inprogress_job = NULL; + BIO_printf(bio_err, "Failure in the job\n"); + ERR_print_errors(bio_err); + error = 1; + break; } } } -- 2.25.1