aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-20 14:49:46 -0700
committerChris Robinson <[email protected]>2014-03-20 14:49:46 -0700
commite6e3937fa9d1d192bc26b900438b45c0e6eb5be2 (patch)
tree97e65b55932f8b925e733273ba238a3b18b87536 /Alc/ALc.c
parent168149ce9daedb2e3d9a11b7fee2b22b2e4daf7a (diff)
Use flexible array members to pad the device and context structs
This helps avoid the convoluted math otherwise required to ensure the default slot and listener, respectively, are aligned.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index d67cf924..77175730 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2885,11 +2885,11 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
return NULL;
}
- ALContext = calloc(1, sizeof(ALCcontext)+15+sizeof(ALlistener));
+ ALContext = calloc(1, sizeof(ALCcontext)+sizeof(ALlistener));
if(ALContext)
{
ALContext->ref = 1;
- ALContext->Listener = (ALlistener*)(((ALintptrEXT)(ALContext+1)+15)&~15);
+ ALContext->Listener = (ALlistener*)ALContext->_listener_mem;
ALContext->MaxActiveSources = 256;
ALContext->ActiveSources = calloc(ALContext->MaxActiveSources,
@@ -3067,7 +3067,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
if(deviceName && (!deviceName[0] || strcasecmp(deviceName, alcDefaultName) == 0 || strcasecmp(deviceName, "openal-soft") == 0))
deviceName = NULL;
- device = al_calloc(16, sizeof(ALCdevice)+15+sizeof(ALeffectslot));
+ device = al_calloc(16, sizeof(ALCdevice)+sizeof(ALeffectslot));
if(!device)
{
alcSetError(NULL, ALC_OUT_OF_MEMORY);
@@ -3280,7 +3280,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
if(DefaultEffect.type != AL_EFFECT_NULL)
{
- device->DefaultSlot = (ALeffectslot*)(((ALintptrEXT)(device+1)+15)&~15);
+ device->DefaultSlot = (ALeffectslot*)device->_slot_mem;
if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR)
{
device->DefaultSlot = NULL;