Use & instead of address()

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

View File

@ -339,9 +339,9 @@ get_device_information(CComPtr<IPortableDevice> &device, IPortableDeviceProperti
pyobject_raii storage(get_storage_info(device)); pyobject_raii storage(get_storage_info(device));
if (!storage) { if (!storage) {
pyobject_raii exc_type, exc_value, exc_tb; pyobject_raii exc_type, exc_value, exc_tb;
PyErr_Fetch(exc_type.address(), exc_value.address(), exc_tb.address()); PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
if (exc_type) { if (exc_type) {
PyErr_NormalizeException(exc_type.address(), exc_value.address(), exc_tb.address()); PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb);
PyDict_SetItemString(ans, "storage_error", exc_value.ptr()); PyDict_SetItemString(ans, "storage_error", exc_value.ptr());
} else { } else {
PyDict_SetItemString(ans, "storage_error", PyUnicode_FromString("get_storage_info() failed without an error set")); PyDict_SetItemString(ans, "storage_error", PyUnicode_FromString("get_storage_info() failed without an error set"));

View File

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