Commit 7941c7ea authored by Davi Arnaut's avatar Davi Arnaut

Cleanup my_win_init by moving time and registry related

initialization to specific functions. Also, remove a large
block of white space. There shouldn't be any functional
change.
parent ac665ecf
......@@ -311,65 +311,17 @@ int handle_rtc_failure(int err_type, const char *file, int line,
#pragma runtime_checks("", restore)
#endif
#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
#define MS 10000000
static void my_win_init(void)
static void win_init_time(void)
{
DBUG_ENTER("my_win_init");
#if defined(_MSC_VER)
#if _MSC_VER < 1300
/*
Clear the OS system variable TZ and avoid the 100% CPU usage
Only for old versions of Visual C++
*/
_putenv( "TZ=" );
#endif
#if _MSC_VER >= 1400
/* this is required to make crt functions return -1 appropriately */
_set_invalid_parameter_handler(my_parameter_handler);
#endif
#endif
#ifdef __MSVC_RUNTIME_CHECKS
/*
Install handler to send RTC (Runtime Error Check) warnings
to log file
*/
_RTC_SetErrorFunc(handle_rtc_failure);
#endif
_tzset();
/* The following is used by time functions */
#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
#define MS 10000000
{
FILETIME ft;
LARGE_INTEGER li, t_cnt;
DBUG_ASSERT(sizeof(LARGE_INTEGER) == sizeof(query_performance_frequency));
if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency) == 0)
query_performance_frequency= 0;
else
......@@ -385,14 +337,17 @@ static void my_win_init(void)
query_performance_frequency * MS /
query_performance_frequency);
}
}
}
{
/*
/*
Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found
there as environment variables
*/
*/
static void win_init_registry(void)
{
HKEY key_handle;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)"SOFTWARE\\MySQL",
0, KEY_READ, &key_handle) == ERROR_SUCCESS)
{
......@@ -435,10 +390,43 @@ static void my_win_init(void)
key_data_len= sizeof(key_data) - 1;
}
RegCloseKey(key_handle) ;
}
RegCloseKey(key_handle);
}
DBUG_VOID_RETURN ;
}
static void my_win_init(void)
{
DBUG_ENTER("my_win_init");
#if defined(_MSC_VER)
#if _MSC_VER < 1300
/*
Clear the OS system variable TZ and avoid the 100% CPU usage
Only for old versions of Visual C++
*/
_putenv("TZ=");
#endif
#if _MSC_VER >= 1400
/* this is required to make crt functions return -1 appropriately */
_set_invalid_parameter_handler(my_parameter_handler);
#endif
#endif
#ifdef __MSVC_RUNTIME_CHECKS
/*
Install handler to send RTC (Runtime Error Check) warnings
to log file
*/
_RTC_SetErrorFunc(handle_rtc_failure);
#endif
_tzset();
win_init_time();
win_init_registry();
DBUG_VOID_RETURN;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment