diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2020-05-15 11:47:09 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-10-11 20:13:04 +0100 |
| commit | e316b0d3d64eb8f65f4109c1565d929b29e1d33a (patch) | |
| tree | 1742e4956f2a8a91ef574cf67c6d05d91910407f /src/streams | |
| parent | 8970acb750ecf4b86883d9ea1a8cb280517e6c86 (diff) | |
| download | libgit2-e316b0d3d64eb8f65f4109c1565d929b29e1d33a.tar.gz | |
runtime: move init/shutdown into the "runtime"
Provide a mechanism for system components to register for initialization
and shutdown of the libgit2 runtime.
Diffstat (limited to 'src/streams')
| -rw-r--r-- | src/streams/mbedtls.c | 6 | ||||
| -rw-r--r-- | src/streams/openssl.c | 10 | ||||
| -rw-r--r-- | src/streams/registry.c | 5 | ||||
| -rw-r--r-- | src/streams/tls.c | 1 |
4 files changed, 8 insertions, 14 deletions
diff --git a/src/streams/mbedtls.c b/src/streams/mbedtls.c index cbe2f681a..00daa5521 100644 --- a/src/streams/mbedtls.c +++ b/src/streams/mbedtls.c @@ -11,7 +11,7 @@ #include <ctype.h> -#include "global.h" +#include "runtime.h" #include "stream.h" #include "streams/socket.h" #include "netops.h" @@ -152,9 +152,7 @@ int git_mbedtls_stream_global_init(void) if (!loaded && crtpath != NULL && stat(crtpath, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) loaded = (git_mbedtls__set_cert_location(crtpath, 1) == 0); - git__on_shutdown(shutdown_ssl); - - return 0; + return git_runtime_shutdown_register(shutdown_ssl); cleanup: mbedtls_ctr_drbg_free(ctr_drbg); diff --git a/src/streams/openssl.c b/src/streams/openssl.c index 58265c1ec..0a0c2c5e5 100644 --- a/src/streams/openssl.c +++ b/src/streams/openssl.c @@ -11,7 +11,7 @@ #include <ctype.h> -#include "global.h" +#include "runtime.h" #include "settings.h" #include "posix.h" #include "stream.h" @@ -286,9 +286,7 @@ int git_openssl_stream_global_init(void) if (init_bio_method() < 0) goto error; - git__on_shutdown(shutdown_ssl); - - return 0; + return git_runtime_shutdown_register(shutdown_ssl); error: git_error_set(GIT_ERROR_NET, "could not initialize openssl: %s", @@ -325,8 +323,8 @@ int git_openssl_set_locking(void) } CRYPTO_set_locking_callback(openssl_locking_function); - git__on_shutdown(shutdown_ssl_locking); - return 0; + return git_runtime_shutdown_register(shutdown_ssl_locking); + #elif !defined(OPENSSL_LEGACY_API) return 0; #else diff --git a/src/streams/registry.c b/src/streams/registry.c index 284431207..b3bf17a4e 100644 --- a/src/streams/registry.c +++ b/src/streams/registry.c @@ -9,7 +9,7 @@ #include "streams/registry.h" -#include "global.h" +#include "runtime.h" #include "streams/tls.h" #include "streams/mbedtls.h" #include "streams/openssl.h" @@ -33,8 +33,7 @@ int git_stream_registry_global_init(void) if (git_rwlock_init(&stream_registry.lock) < 0) return -1; - git__on_shutdown(shutdown_stream_registry); - return 0; + return git_runtime_shutdown_register(shutdown_stream_registry); } GIT_INLINE(void) stream_registration_cpy( diff --git a/src/streams/tls.c b/src/streams/tls.c index 6a251717b..255a4a0f6 100644 --- a/src/streams/tls.c +++ b/src/streams/tls.c @@ -8,7 +8,6 @@ #include "git2/errors.h" #include "common.h" -#include "global.h" #include "streams/registry.h" #include "streams/tls.h" #include "streams/mbedtls.h" |
