Simplify code by folding {Initialize,Cleanu[}CURL() in the caller

There doesn't seem to be any need to have separate functions when they
are just trivial wrappers.
This commit is contained in:
Vadim Zeitlin
2020-12-13 16:57:16 +01:00
parent 9cc35c54d2
commit 7027f66a9a
2 changed files with 5 additions and 20 deletions

View File

@@ -137,10 +137,6 @@ private:
static int ms_activeSessions;
static void InitializeCURL();
static void CleanupCURL();
wxDECLARE_NO_COPY_CLASS(wxWebSessionCURL);
};

View File

@@ -346,7 +346,10 @@ wxWebSessionCURL::wxWebSessionCURL() :
{
// Initialize CURL globally if no sessions are active
if ( ms_activeSessions == 0 )
InitializeCURL();
{
if ( curl_global_init(CURL_GLOBAL_ALL) )
wxLogError("libcurl could not be initialized");
}
ms_activeSessions++;
}
@@ -370,7 +373,7 @@ wxWebSessionCURL::~wxWebSessionCURL()
// Global CURL cleanup if this is the last session
--ms_activeSessions;
if ( ms_activeSessions == 0 )
CleanupCURL();
curl_global_cleanup();
}
void wxWebSessionCURL::Initialize()
@@ -534,18 +537,4 @@ wxVersionInfo wxWebSessionCURL::GetLibraryVersionInfo()
desc);
}
// static
void wxWebSessionCURL::InitializeCURL()
{
if ( curl_global_init(CURL_GLOBAL_ALL) )
wxLogError("libcurl could not be initialized");
}
// static
void wxWebSessionCURL::CleanupCURL()
{
if ( ms_activeSessions == 0 )
curl_global_cleanup();
}
#endif // wxUSE_WEBREQUEST_CURL