From 55ede3b41b7cea43ca2453b115ba8e354015be09 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 19 Mar 2010 09:17:42 +0100 Subject: [PATCH] Shorten constant a bit. More documentation. --- include/libssh2.h | 10 +++++++--- src/global.c | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/libssh2.h b/include/libssh2.h index 293b4a1..0b1a9ea 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -370,14 +370,18 @@ typedef struct _LIBSSH2_POLLFD { #define LIBSSH2_ERROR_AGENT_PROTOCOL -42 /* Global API */ -#define LIBSSH2_INIT_NO_CRYPTO_INIT 0x0001 +#define LIBSSH2_INIT_NO_CRYPTO 0x0001 /* * libssh2_init() * - * Initialize the libssh2 functions. flags can be: + * Initialize the libssh2 functions. This typically initialize the + * crypto library. It uses a global state, and is not thread safe -- + * you must make sure this function is not called concurrently. + * + * Flags can be: * 0: Normal initialize - * LIBSSH2_INIT_NO_CRYPTO_INIT: Do not initialize the crypto library (ie. + * LIBSSH2_INIT_NO_CRYPTO: Do not initialize the crypto library (ie. * OPENSSL_add_cipher_algoritms() for OpenSSL * * Returns 0 if succeeded, or a negative value for error. diff --git a/src/global.c b/src/global.c index 721d253..65f36f0 100644 --- a/src/global.c +++ b/src/global.c @@ -1,4 +1,5 @@ /* Copyright (c) 2010 Lars Nordin + * Copyright (C) 2010 Simon Josefsson * All rights reserved. * * Redistribution and use in source and binary forms, @@ -42,7 +43,7 @@ static int _libssh2_init_flags = 0; LIBSSH2_API int libssh2_init(int flags) { - if (libssh2_initialized == 0 && !(flags & LIBSSH2_INIT_NO_CRYPTO_INIT)) { + if (libssh2_initialized == 0 && !(flags & LIBSSH2_INIT_NO_CRYPTO)) { libssh2_crypto_init(); } @@ -59,7 +60,7 @@ LIBSSH2_API void libssh2_exit() libssh2_initialized--; - if (!(libssh2_init_flags & LIBSSH2_INIT_NO_CRYPTO_INIT)) { + if (!(libssh2_init_flags & LIBSSH2_INIT_NO_CRYPTO)) { libssh2_crypto_exit(); }