From 4c35a40858db71daa0f6be4111c620fb201f245a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 15 Jan 2006 23:55:53 +0000 Subject: 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. --- lib/easy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/easy.c b/lib/easy.c index 80fd764c5..2de18037f 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -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; } -- cgit v1.2.3