diff options
author | ienkovich <ienkovich@yandex-team.ru> | 2022-02-10 16:47:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:50 +0300 |
commit | 0a579de32b745908473b2cea7c5cd5540bc801f0 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /contrib/libs | |
parent | 5bd76e73fa8dd777999be2668ff56928cc3dbecb (diff) | |
download | ydb-0a579de32b745908473b2cea7c5cd5540bc801f0.tar.gz |
Restoring authorship annotation for <ienkovich@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs')
-rw-r--r-- | contrib/libs/c-ares/ares_library_init.c | 52 | ||||
-rw-r--r-- | contrib/libs/c-ares/atomic.cpp | 26 | ||||
-rw-r--r-- | contrib/libs/c-ares/atomic.h | 30 | ||||
-rw-r--r-- | contrib/libs/c-ares/ya.make | 2 |
4 files changed, 55 insertions, 55 deletions
diff --git a/contrib/libs/c-ares/ares_library_init.c b/contrib/libs/c-ares/ares_library_init.c index f244d0bd42..3c7ad37200 100644 --- a/contrib/libs/c-ares/ares_library_init.c +++ b/contrib/libs/c-ares/ares_library_init.c @@ -21,8 +21,8 @@ #include "ares_library_init.h" #include "ares_private.h" -#include "atomic.h" - +#include "atomic.h" + /* library-private global and unique instance vars */ #ifdef USE_WINSOCK @@ -38,7 +38,7 @@ fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL; /* library-private global vars with source visibility restricted to this file */ -static atomic_t ares_init_lock; +static atomic_t ares_init_lock; static unsigned int ares_initialized; static int ares_init_flags; @@ -130,23 +130,23 @@ static void ares_win32_cleanup(void) int ares_library_init(int flags) { - int res = ARES_SUCCESS; + int res = ARES_SUCCESS; + + acquire_lock(&ares_init_lock); - acquire_lock(&ares_init_lock); - - ares_initialized++; - if (ares_initialized == 1) + ares_initialized++; + if (ares_initialized == 1) { - if (flags & ARES_LIB_INIT_WIN32) - res = ares_win32_init(); + if (flags & ARES_LIB_INIT_WIN32) + res = ares_win32_init(); - if (res == ARES_SUCCESS) - ares_init_flags = flags; + if (res == ARES_SUCCESS) + ares_init_flags = flags; } - release_lock(&ares_init_lock); + release_lock(&ares_init_lock); - return res; + return res; } int ares_library_init_mem(int flags, @@ -166,28 +166,28 @@ int ares_library_init_mem(int flags, void ares_library_cleanup(void) { - acquire_lock(&ares_init_lock); - + acquire_lock(&ares_init_lock); + if (ares_initialized) - { - ares_initialized--; - if (!ares_initialized) - { - if (ares_init_flags & ARES_LIB_INIT_WIN32) - ares_win32_cleanup(); + { + ares_initialized--; + if (!ares_initialized) + { + if (ares_init_flags & ARES_LIB_INIT_WIN32) + ares_win32_cleanup(); #if defined(ANDROID) || defined(__ANDROID__) ares_library_cleanup_android(); #endif - ares_init_flags = ARES_LIB_INIT_NONE; + ares_init_flags = ARES_LIB_INIT_NONE; ares_malloc = malloc; ares_realloc = realloc; ares_free = free; - } - } + } + } - release_lock(&ares_init_lock); + release_lock(&ares_init_lock); } diff --git a/contrib/libs/c-ares/atomic.cpp b/contrib/libs/c-ares/atomic.cpp index 5f5ea36ebb..e193a64b37 100644 --- a/contrib/libs/c-ares/atomic.cpp +++ b/contrib/libs/c-ares/atomic.cpp @@ -1,13 +1,13 @@ -#include <util/system/spinlock.h> - -#include "atomic.h" - -EXTERN_C void acquire_lock(atomic_t *lock) -{ - AcquireAdaptiveLock(lock); -} - -EXTERN_C void release_lock(atomic_t *lock) -{ - ReleaseAdaptiveLock(lock); -} +#include <util/system/spinlock.h> + +#include "atomic.h" + +EXTERN_C void acquire_lock(atomic_t *lock) +{ + AcquireAdaptiveLock(lock); +} + +EXTERN_C void release_lock(atomic_t *lock) +{ + ReleaseAdaptiveLock(lock); +} diff --git a/contrib/libs/c-ares/atomic.h b/contrib/libs/c-ares/atomic.h index 2b09f5c5a1..9b26bcdc0b 100644 --- a/contrib/libs/c-ares/atomic.h +++ b/contrib/libs/c-ares/atomic.h @@ -1,15 +1,15 @@ -#ifndef ATOMIC__H -#define ATOMIC__H - -typedef volatile intptr_t atomic_t; - -#ifdef __cplusplus - #define EXTERN_C extern "C" -#else - #define EXTERN_C -#endif - -EXTERN_C void acquire_lock(atomic_t *lock); -EXTERN_C void release_lock(atomic_t *lock); - -#endif +#ifndef ATOMIC__H +#define ATOMIC__H + +typedef volatile intptr_t atomic_t; + +#ifdef __cplusplus + #define EXTERN_C extern "C" +#else + #define EXTERN_C +#endif + +EXTERN_C void acquire_lock(atomic_t *lock); +EXTERN_C void release_lock(atomic_t *lock); + +#endif diff --git a/contrib/libs/c-ares/ya.make b/contrib/libs/c-ares/ya.make index a3409a977f..bd35762e44 100644 --- a/contrib/libs/c-ares/ya.make +++ b/contrib/libs/c-ares/ya.make @@ -101,7 +101,7 @@ SRCS( ares_timeout.c ares_version.c ares_writev.c - atomic.cpp + atomic.cpp bitncmp.c inet_net_pton.c inet_ntop.c |