Make the RAII constructor explicit

This commit is contained in:
Kovid Goyal 2021-04-21 08:28:07 +05:30
parent 25ae5a1284
commit a5de2b33c0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 4 deletions

View File

@ -18,7 +18,7 @@ CComPtr<IPortableDeviceManager> wpd::portable_device_manager = NULL;
// Flag indicating if COM has been initialized
static int _com_initialized = 0;
// Application Info
wpd::ClientInfo wpd::client_info = {0};
wpd::ClientInfo wpd::client_info;
// Module startup/shutdown {{{
static PyObject *

View File

@ -34,11 +34,11 @@ class generic_raii {
generic_raii & operator=( const generic_raii & ) ;
public:
generic_raii(T h = null) : handle(h) {}
explicit generic_raii(T h = null) : handle(h) {}
~generic_raii() { release(); }
void release() {
if (handle) {
if (handle != null) {
free_T(handle);
handle = null;
}
@ -49,7 +49,6 @@ class generic_raii {
void set_ptr(T val) { handle = val; }
T* address() { return &handle; }
explicit operator bool() const { return handle != null; }
T operator->() { return handle; }
};
typedef generic_raii<wchar_t*, PyMem_Free, NULL> wchar_raii;