diff --git a/src/i_pcsound.c b/src/i_pcsound.c index 08ce1cfb9..f6ea2138e 100644 --- a/src/i_pcsound.c +++ b/src/i_pcsound.c @@ -21,6 +21,7 @@ #include "doomstat.h" #include "doomtype.h" +#include "i_oalcommon.h" #include "i_oalsound.h" #include "i_printf.h" #include "i_sound.h" @@ -31,16 +32,6 @@ #include "w_wad.h" #include "z_zone.h" -// C doesn't allow casting between function and non-function pointer types, so -// with C99 we need to use a union to reinterpret the pointer type. Pre-C99 -// still needs to use a normal cast and live with the warning (C++ is fine with -// a regular reinterpret_cast). -#if __STDC_VERSION__ >= 199901L -# define FUNCTION_CAST(T, ptr) (union{void *p; T f;}){ptr}.f -#else -# define FUNCTION_CAST(T, ptr) (T)(ptr) -#endif - static LPALBUFFERCALLBACKSOFT alBufferCallbackSOFT; static ALuint callback_buffer; static ALuint callback_source; @@ -288,8 +279,7 @@ static void RegisterCallback(void) "RegisterCallback: AL_SOFT_callback_buffer not found."); return; } - alBufferCallbackSOFT = FUNCTION_CAST( - LPALBUFFERCALLBACKSOFT, alGetProcAddress("alBufferCallbackSOFT")); + ALFUNC(LPALBUFFERCALLBACKSOFT, alBufferCallbackSOFT); alGenBuffers(1, &callback_buffer); alGenSources(1, &callback_source);