summaryrefslogtreecommitdiffstats
path: root/contrib/libs/c-ares/ares_library_init.c
diff options
context:
space:
mode:
authorsnermolaev <[email protected]>2022-02-10 16:45:53 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:53 +0300
commit7353a3fdea9c67c256980c00a2b3b67f09b23a27 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/c-ares/ares_library_init.c
parent2015790ac9fcc04caab83fccc23ab2460310a797 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/c-ares/ares_library_init.c')
-rw-r--r--contrib/libs/c-ares/ares_library_init.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/contrib/libs/c-ares/ares_library_init.c b/contrib/libs/c-ares/ares_library_init.c
index 8eaae2a83cd..3c7ad372006 100644
--- a/contrib/libs/c-ares/ares_library_init.c
+++ b/contrib/libs/c-ares/ares_library_init.c
@@ -29,20 +29,20 @@
fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL;
fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL;
fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL;
-fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL;
+fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL;
+#endif
+
+#if defined(ANDROID) || defined(__ANDROID__)
+#include "ares_android.h"
#endif
-#if defined(ANDROID) || defined(__ANDROID__)
-#include "ares_android.h"
-#endif
-
/* library-private global vars with source visibility restricted to this file */
static atomic_t ares_init_lock;
static unsigned int ares_initialized;
static int ares_init_flags;
-/* library-private global vars with visibility across the whole library */
+/* library-private global vars with visibility across the whole library */
#if defined(WIN32)
/* We need indirections to handle Windows DLL rules. */
static void *default_malloc(size_t size) { return malloc(size); }
@@ -56,7 +56,7 @@ static void default_free(void *p) { free(p); }
void *(*ares_malloc)(size_t size) = default_malloc;
void *(*ares_realloc)(void *ptr, size_t size) = default_realloc;
void (*ares_free)(void *ptr) = default_free;
-
+
#ifdef USE_WINSOCK
static HMODULE hnd_iphlpapi;
static HMODULE hnd_advapi32;
@@ -68,7 +68,7 @@ static int ares_win32_init(void)
#ifdef USE_WINSOCK
hnd_iphlpapi = 0;
- hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll");
+ hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll");
if (!hnd_iphlpapi)
return ARES_ELOADIPHLPAPI;
@@ -89,15 +89,15 @@ static int ares_win32_init(void)
support Windows 2000 anymore */
}
- ares_fpGetBestRoute2 = (fpGetBestRoute2_t)
- GetProcAddress(hnd_iphlpapi, "GetBestRoute2");
- if (!ares_fpGetBestRoute2)
- {
- /* This can happen on clients before Vista, I don't
- think it should be an error, unless we don't want to
- support Windows XP anymore */
- }
-
+ ares_fpGetBestRoute2 = (fpGetBestRoute2_t)
+ GetProcAddress(hnd_iphlpapi, "GetBestRoute2");
+ if (!ares_fpGetBestRoute2)
+ {
+ /* This can happen on clients before Vista, I don't
+ think it should be an error, unless we don't want to
+ support Windows XP anymore */
+ }
+
/*
* When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036,
* also known as RtlGenRandom, which is the case for Windows versions prior
@@ -105,7 +105,7 @@ static int ares_win32_init(void)
*/
hnd_advapi32 = 0;
- hnd_advapi32 = LoadLibraryW(L"advapi32.dll");
+ hnd_advapi32 = LoadLibraryW(L"advapi32.dll");
if (hnd_advapi32)
{
ares_fpSystemFunction036 = (fpSystemFunction036_t)
@@ -149,21 +149,21 @@ int ares_library_init(int flags)
return res;
}
-int ares_library_init_mem(int flags,
- void *(*amalloc)(size_t size),
- void (*afree)(void *ptr),
- void *(*arealloc)(void *ptr, size_t size))
-{
- if (amalloc)
- ares_malloc = amalloc;
- if (arealloc)
- ares_realloc = arealloc;
- if (afree)
- ares_free = afree;
- return ares_library_init(flags);
-}
-
-
+int ares_library_init_mem(int flags,
+ void *(*amalloc)(size_t size),
+ void (*afree)(void *ptr),
+ void *(*arealloc)(void *ptr, size_t size))
+{
+ if (amalloc)
+ ares_malloc = amalloc;
+ if (arealloc)
+ ares_realloc = arealloc;
+ if (afree)
+ ares_free = afree;
+ return ares_library_init(flags);
+}
+
+
void ares_library_cleanup(void)
{
acquire_lock(&ares_init_lock);
@@ -176,14 +176,14 @@ void ares_library_cleanup(void)
if (ares_init_flags & ARES_LIB_INIT_WIN32)
ares_win32_cleanup();
-#if defined(ANDROID) || defined(__ANDROID__)
- ares_library_cleanup_android();
-#endif
-
+#if defined(ANDROID) || defined(__ANDROID__)
+ ares_library_cleanup_android();
+#endif
+
ares_init_flags = ARES_LIB_INIT_NONE;
- ares_malloc = malloc;
- ares_realloc = realloc;
- ares_free = free;
+ ares_malloc = malloc;
+ ares_realloc = realloc;
+ ares_free = free;
}
}