Skip to content

Commit f775ee6

Browse files
committed
Fix innodb compilation failure on Windows
We don't need to print an error when loading kernel32.dll. If we can't load it we'll automatically crash. Reviewed by wlad@mariadb.com
1 parent 12c42bd commit f775ee6

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3645,9 +3645,7 @@ innobase_init(
36453645

36463646
#ifndef UNIV_HOTBACKUP
36473647
#ifdef _WIN32
3648-
if (ut_win_init_time()) {
3649-
goto mem_free_and_error;
3650-
}
3648+
ut_win_init_time();
36513649
#endif /* _WIN32 */
36523650
#endif /* !UNIV_HOTBACKUP */
36533651

storage/innobase/include/ut0ut.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,10 @@ ut_time_ms(void);
275275
/*============*/
276276
#ifdef _WIN32
277277
/**********************************************************//**
278-
Initialise highest available time resolution API on Windows
279-
@return 0 if all OK else -1 */
280-
int
278+
Initialise highest available time resolution API on Windows.
279+
Crashes if there's an error loading kernel32.dll.
280+
*/
281+
void
281282
ut_win_init_time();
282283

283284
#endif /* _WIN32 */

storage/innobase/ut/ut0ut.cc

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ Created 5/11/1994 Heikki Tuuri
4949
UNIV_INTERN ibool ut_always_false = FALSE;
5050

5151
#ifdef __WIN__
52-
#include <mysql/innodb_priv.h> /* For sql_print_error */
5352
typedef VOID(WINAPI *time_fn)(LPFILETIME);
5453
static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime;
5554

@@ -61,25 +60,20 @@ epoch starts from 1970/1/1. For selection of constant see:
6160

6261

6362
/**
64-
Initialise highest available time resolution API on Windows
65-
@return 0 if all OK else -1 */
66-
int
63+
Initialise highest available time resolution API on Windows.
64+
Crashes if there's an error loading kernel32.dll.
65+
*/
66+
void
6767
ut_win_init_time()
6868
{
6969
HMODULE h = LoadLibrary("kernel32.dll");
70-
if (h != NULL)
70+
ut_a(h);
71+
time_fn pfn = (time_fn)GetProcAddress(h, "GetSystemTimePreciseAsFileTime");
72+
if (pfn != NULL)
7173
{
72-
time_fn pfn = (time_fn)GetProcAddress(h, "GetSystemTimePreciseAsFileTime");
73-
if (pfn != NULL)
74-
{
75-
ut_get_system_time_as_file_time = pfn;
76-
}
77-
return false;
74+
ut_get_system_time_as_file_time = pfn;
7875
}
79-
DWORD error = GetLastError();
80-
sql_print_error(
81-
"LoadLibrary(\"kernel32.dll\") failed: GetLastError returns %lu", error);
82-
return(-1);
76+
return;
8377
}
8478

8579
/*****************************************************************//**

0 commit comments

Comments
 (0)