[openssl-dev] [Suggestion] crypto/threads_win.c: Follow Consistent Return Style
Matt Caswell
matt at openssl.org
Mon May 9 09:41:25 UTC 2016
Looks ok to me. I suggest you raise it as a GitHub PR.
Matt
On 08/05/16 08:52, Kurt Cancemi wrote:
> Every function that returns an int in crypto/threads_win.c returns 0
> immediately if the function called from inside the function fails
> except CRYPTO_THREAD_run_once() which returns 1 immediately if the
> function called from inside the function succeeds.
>
> InitOnceExecuteOnce returns 0 on failure
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms683493%28v=vs.85%29.aspx
>
> So my suggestion would be to follow this convention in
> CRYPTO_THREAD_run_once() too:
>
> --- crypto/threads_win.c 2016-05-08 03:42:44.401795919 -0400
> +++ crypto/threads_win.c 2016-05-08 03:42:55.151796152 -0400
> @@ -135,10 +135,10 @@
>
> int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
> {
> - if (InitOnceExecuteOnce(once, once_cb, init, NULL))
> - return 1;
> + if (!InitOnceExecuteOnce(once, once_cb, init, NULL))
> + return 0;
>
> - return 0;
> + return 1;
> }
>
> # endif
>
> --
> Kurt Cancemi
> https://www.x64architecture.com
>
More information about the openssl-dev
mailing list