aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-09-12 17:29:35 -0700
committerChris Robinson <[email protected]>2009-09-12 17:29:35 -0700
commit8b36a9d1214ec5f51708589f6fc86c087a2dd545 (patch)
treed287ee97fe863e6c632322f945a9b9fc92e12e03
parent59ed9338d88fc76c54c68c79af6b2f2999eac6df (diff)
Get rid of deinit code duplication
-rw-r--r--Alc/ALc.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 16272ecc..40a2606d 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -215,6 +215,8 @@ static ALboolean init_done = AL_FALSE;
///////////////////////////////////////////////////////
// ALC Related helper functions
#ifdef _WIN32
+static void alc_deinit();
+
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
int i;
@@ -229,26 +231,18 @@ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
break;
case DLL_PROCESS_DETACH:
- if(!init_done)
- break;
- ReleaseALC();
-
- for(i = 0;BackendList[i].Deinit;i++)
- BackendList[i].Deinit();
-
- tls_delete(LocalContext);
-
- FreeALConfig();
- ALTHUNK_EXIT();
- DeleteCriticalSection(&g_csMutex);
+ alc_deinit();
break;
}
return TRUE;
}
#else
#ifdef HAVE_GCC_DESTRUCTOR
-static void my_deinit() __attribute__((destructor));
-static void my_deinit()
+static void alc_deinit() __attribute__((destructor));
+#endif
+#endif
+
+static void alc_deinit()
{
static ALenum once = AL_FALSE;
int i;
@@ -267,8 +261,6 @@ static void my_deinit()
ALTHUNK_EXIT();
DeleteCriticalSection(&g_csMutex);
}
-#endif
-#endif
static void ProbeDeviceList()
{