Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
winansi: simplify loading the GetCurrentConsoleFontEx() function
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Thu, 13 Jun 2019 11:49:46 +0000
(
04:49
-0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 13 Jun 2019 16:34:16 +0000
(09:34 -0700)
We introduced helper macros to simplify loading functions dynamically.
Might just as well use them.
This also side-steps a compiler warning when building with GCC v8.x: it
would complain about casting between incompatible function pointers.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/winansi.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
08e0450
)
diff --git
a/compat/winansi.c
b/compat/winansi.c
index f4f08237f9ed513e0dd3b3bfd9494f19944e3239..a29d34ef44864f02bd89c8490d38bca0efe2a8e6 100644
(file)
--- a/
compat/winansi.c
+++ b/
compat/winansi.c
@@
-7,6
+7,7
@@
#include <wingdi.h>
#include <winreg.h>
#include "win32.h"
#include <wingdi.h>
#include <winreg.h>
#include "win32.h"
+#include "win32/lazyload.h"
static int fd_is_interactive[3] = { 0, 0, 0 };
#define FD_CONSOLE 0x1
static int fd_is_interactive[3] = { 0, 0, 0 };
#define FD_CONSOLE 0x1
@@
-41,26
+42,21
@@
typedef struct _CONSOLE_FONT_INFOEX {
#endif
#endif
#endif
#endif
-typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL,
- PCONSOLE_FONT_INFOEX);
-
static void warn_if_raster_font(void)
{
DWORD fontFamily = 0;
static void warn_if_raster_font(void)
{
DWORD fontFamily = 0;
- PGETCURRENTCONSOLEFONTEX pGetCurrentConsoleFontEx;
+ DECLARE_PROC_ADDR(kernel32.dll, BOOL, GetCurrentConsoleFontEx,
+ HANDLE, BOOL, PCONSOLE_FONT_INFOEX);
/* don't bother if output was ascii only */
if (!non_ascii_used)
return;
/* GetCurrentConsoleFontEx is available since Vista */
/* don't bother if output was ascii only */
if (!non_ascii_used)
return;
/* GetCurrentConsoleFontEx is available since Vista */
- pGetCurrentConsoleFontEx = (PGETCURRENTCONSOLEFONTEX) GetProcAddress(
- GetModuleHandle("kernel32.dll"),
- "GetCurrentConsoleFontEx");
- if (pGetCurrentConsoleFontEx) {
+ if (INIT_PROC_ADDR(GetCurrentConsoleFontEx)) {
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof(cfi);
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof(cfi);
- if (
p
GetCurrentConsoleFontEx(console, 0, &cfi))
+ if (GetCurrentConsoleFontEx(console, 0, &cfi))
fontFamily = cfi.FontFamily;
} else {
/* pre-Vista: check default console font in registry */
fontFamily = cfi.FontFamily;
} else {
/* pre-Vista: check default console font in registry */