mirror of
https://github.com/curl/curl.git
synced 2026-07-29 23:28:08 +03:00
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:
parent
802b2aaf6a
commit
4c35a40858
7 changed files with 162 additions and 31 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue