diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2017-01-29 23:59:24 +1100 |
---|---|---|
committer | James Ross-Gowan <rossymiles@gmail.com> | 2017-01-30 00:22:30 +1100 |
commit | 9692814502223574b575931d32ddd458b9476bb6 (patch) | |
tree | 8a86cb132d6b03e46a28fa18218be1da20607ea6 /audio/out/ao_wasapi.h | |
parent | a6d29494ca6e45b66570deda99c2eef79f72d16c (diff) | |
download | mpv-9692814502223574b575931d32ddd458b9476bb6.tar.bz2 mpv-9692814502223574b575931d32ddd458b9476bb6.tar.xz |
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.
Diffstat (limited to 'audio/out/ao_wasapi.h')
-rw-r--r-- | audio/out/ao_wasapi.h | 2 |
1 files changed, 1 insertions, 1 deletions
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) \ |