Bryan Henderson turned the 'initialized' variable for curl_global_init()
into a counter, and thus you can now do multiple curl_global_init() and you are then supposed to do the same amount of calls to curl_global_cleanup(). Bryan also updated the docs accordingly.
This commit is contained in:
@@ -190,7 +190,7 @@ curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
|
||||
*/
|
||||
CURLcode curl_global_init(long flags)
|
||||
{
|
||||
if (initialized)
|
||||
if (initialized++)
|
||||
return CURLE_OK;
|
||||
|
||||
/* Setup the default memory functions here (again) */
|
||||
@@ -217,7 +217,6 @@ CURLcode curl_global_init(long flags)
|
||||
idna_init();
|
||||
#endif
|
||||
|
||||
initialized = 1;
|
||||
init_flags = flags;
|
||||
|
||||
return CURLE_OK;
|
||||
@@ -263,6 +262,9 @@ void curl_global_cleanup(void)
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
if (--initialized)
|
||||
return;
|
||||
|
||||
Curl_global_host_cache_dtor();
|
||||
|
||||
if (init_flags & CURL_GLOBAL_SSL)
|
||||
@@ -275,7 +277,6 @@ void curl_global_cleanup(void)
|
||||
amiga_cleanup();
|
||||
#endif
|
||||
|
||||
initialized = 0;
|
||||
init_flags = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user