aboutsummaryrefslogtreecommitdiffstats
path: root/router
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-29 08:46:06 -0700
committerChris Robinson <[email protected]>2017-06-29 08:46:06 -0700
commitf08a7b341fc11da84974fe868649af6a0ccd9b3e (patch)
tree8c4b174b0692d5c6a78dfe6e99e55bb8786eadd2 /router
parent15e6821147746fcdd1e7d38e830677641669ff5d (diff)
Prepare the new driver in a local variable
Diffstat (limited to 'router')
-rw-r--r--router/router.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/router/router.c b/router/router.c
index 0625c1fe..86189b78 100644
--- a/router/router.c
+++ b/router/router.c
@@ -57,6 +57,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
static void AddModule(HMODULE module, const WCHAR *name)
{
+ DriverIface newdrv;
int err = 0;
int i;
@@ -81,10 +82,10 @@ static void AddModule(HMODULE module, const WCHAR *name)
DriverListSizeMax = newmax;
}
+ memset(&newdrv, 0, sizeof(newdrv));
#define LOAD_PROC(x) do { \
- DriverList[DriverListSize].x = CAST_FUNC(DriverList[DriverListSize].x) \
- GetProcAddress(module, #x); \
- if(!DriverList[DriverListSize].x) \
+ newdrv.x = CAST_FUNC(newdrv.x) GetProcAddress(module, #x); \
+ if(!newdrv.x) \
{ \
fprintf(stderr, "Failed to find entry point for %s in %ls\n", \
#x, name); \
@@ -188,15 +189,15 @@ static void AddModule(HMODULE module, const WCHAR *name)
if(!err)
{
ALCint alc_ver[2];
- wcsncpy(DriverList[DriverListSize].Name, name, 32);
- DriverList[DriverListSize].Module = module;
- DriverList[DriverListSize].alcGetIntegerv(NULL, ALC_MAJOR_VERSION, 1, &alc_ver[0]);
- DriverList[DriverListSize].alcGetIntegerv(NULL, ALC_MINOR_VERSION, 1, &alc_ver[1]);
- if(DriverList[DriverListSize].alcGetError(NULL) == ALC_NO_ERROR)
- DriverList[DriverListSize].ALCVer = MAKE_ALC_VER(alc_ver[0], alc_ver[1]);
+ wcsncpy(newdrv.Name, name, 32);
+ newdrv.Module = module;
+ newdrv.alcGetIntegerv(NULL, ALC_MAJOR_VERSION, 1, &alc_ver[0]);
+ newdrv.alcGetIntegerv(NULL, ALC_MINOR_VERSION, 1, &alc_ver[1]);
+ if(newdrv.alcGetError(NULL) == ALC_NO_ERROR)
+ newdrv.ALCVer = MAKE_ALC_VER(alc_ver[0], alc_ver[1]);
else
- DriverList[DriverListSize].ALCVer = MAKE_ALC_VER(1, 0);
- DriverListSize++;
+ newdrv.ALCVer = MAKE_ALC_VER(1, 0);
+ DriverList[DriverListSize++] = newdrv;
}
}