From 9692814502223574b575931d32ddd458b9476bb6 Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Sun, 29 Jan 2017 23:59:24 +1100 Subject: win32: add COM-specific SAFE_RELEASE to windows_utils.h See: https://msdn.microsoft.com/en-us/library/windows/desktop/dd743946.aspx Microsoft example code often uses a SAFE_RELEASE macro like the one in the above link. This makes it easier to avoid errors when releasing COM interfaces. It also reduces noise in COM-heavy code. ao_wasapi.h also had a macro called SAFE_RELEASE, though unlike the version above, its SAFE_RELEASE macro accepted a second parameter which allowed it to destroy arbitrary objects other than just COM interfaces. This renames ao_wasapi's SAFE_RELEASE to SAFE_DESTROY, which should more accurately reflect what it does and prevent confusion with the Microsoft version. --- audio/out/ao_wasapi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/out/ao_wasapi.h') diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h index 65f16d11c1..8f6e38867c 100644 --- a/audio/out/ao_wasapi.h +++ b/audio/out/ao_wasapi.h @@ -47,7 +47,7 @@ void wasapi_change_uninit(struct ao* ao); #define EXIT_ON_ERROR(hres) \ do { if (FAILED(hres)) { goto exit_label; } } while(0) -#define SAFE_RELEASE(unk, release) \ +#define SAFE_DESTROY(unk, release) \ do { if ((unk) != NULL) { release; (unk) = NULL; } } while(0) #define mp_format_res_str(hres) \ -- cgit v1.2.3