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:
@@ -137,10 +137,6 @@ private:
|
|||||||
|
|
||||||
static int ms_activeSessions;
|
static int ms_activeSessions;
|
||||||
|
|
||||||
static void InitializeCURL();
|
|
||||||
|
|
||||||
static void CleanupCURL();
|
|
||||||
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxWebSessionCURL);
|
wxDECLARE_NO_COPY_CLASS(wxWebSessionCURL);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -346,7 +346,10 @@ wxWebSessionCURL::wxWebSessionCURL() :
|
|||||||
{
|
{
|
||||||
// Initialize CURL globally if no sessions are active
|
// Initialize CURL globally if no sessions are active
|
||||||
if ( ms_activeSessions == 0 )
|
if ( ms_activeSessions == 0 )
|
||||||
InitializeCURL();
|
{
|
||||||
|
if ( curl_global_init(CURL_GLOBAL_ALL) )
|
||||||
|
wxLogError("libcurl could not be initialized");
|
||||||
|
}
|
||||||
|
|
||||||
ms_activeSessions++;
|
ms_activeSessions++;
|
||||||
}
|
}
|
||||||
@@ -370,7 +373,7 @@ wxWebSessionCURL::~wxWebSessionCURL()
|
|||||||
// Global CURL cleanup if this is the last session
|
// Global CURL cleanup if this is the last session
|
||||||
--ms_activeSessions;
|
--ms_activeSessions;
|
||||||
if ( ms_activeSessions == 0 )
|
if ( ms_activeSessions == 0 )
|
||||||
CleanupCURL();
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWebSessionCURL::Initialize()
|
void wxWebSessionCURL::Initialize()
|
||||||
@@ -534,18 +537,4 @@ wxVersionInfo wxWebSessionCURL::GetLibraryVersionInfo()
|
|||||||
desc);
|
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
|
#endif // wxUSE_WEBREQUEST_CURL
|
||||||
|
Reference in New Issue
Block a user