mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-28 23:34:49 -05:00
Remove remaining uses of the GLOBAL macro.
We now have no remaining things in header files that switch from being a declaration to a definition depending on an awkward #define at the point of including that header. There are still a few mutable variables with external linkage, but at least now each one is defined in a specific source file file appropriate to its purpose and context. The remaining globals as of this commit were: - 'logctx' and 'term', which never needed to be globals in the first place, because they were never actually shared between source files. Now 'term' is just a static in window.c, and 'logctx' is a static in each of that and winplink.c. - 'hinst', which still has external linkage, but is now defined separately in each source file that sets it up (i.e. those with a WinMain) - osMajorVersion, osMinorVersion and osPlatformId, whose definitions now live in winmisc.c alongside the code which sets them up. (Actually they were defined there all along, it turns out, but every toolchain I've built with has commoned them together with the version defined by the GLOBAL in the header.) - 'hwnd', which nothing was actually _using_ any more after previous commits, so all this commit had to do was delete it.
This commit is contained in:
parent
25f7f8c025
commit
0709de08f2
@ -147,6 +147,8 @@ enum { SYSMENU, CTXMENU };
|
||||
static HMENU savedsess_menu;
|
||||
|
||||
static Conf *conf;
|
||||
static LogContext *logctx;
|
||||
static Terminal *term;
|
||||
|
||||
struct wm_netevent_params {
|
||||
/* Used to pass data to wm_netevent_callback */
|
||||
@ -473,6 +475,8 @@ const unsigned cmdline_tooltype =
|
||||
TOOLTYPE_PORT_ARG |
|
||||
TOOLTYPE_NO_VERBOSE_OPTION;
|
||||
|
||||
HINSTANCE hinst;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
MSG msg;
|
||||
|
@ -1551,6 +1551,8 @@ void cleanup_exit(int code)
|
||||
exit(code);
|
||||
}
|
||||
|
||||
HINSTANCE hinst;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
int argc, i;
|
||||
@ -1561,7 +1563,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
|
||||
init_common_controls();
|
||||
hinst = inst;
|
||||
hwnd = NULL;
|
||||
|
||||
/*
|
||||
* See if we can find our Help file.
|
||||
|
@ -1187,6 +1187,8 @@ static const PageantListenerClientVtable winpgnt_vtable = {
|
||||
|
||||
static struct winpgnt_client wpc[1];
|
||||
|
||||
HINSTANCE hinst;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
{
|
||||
MSG msg;
|
||||
|
@ -30,6 +30,7 @@ BinarySink *stdout_bs, *stderr_bs;
|
||||
DWORD orig_console_mode;
|
||||
|
||||
static Backend *backend;
|
||||
static LogContext *logctx;
|
||||
static Conf *conf;
|
||||
|
||||
static void plink_echoedit_update(Seat *seat, bool echo, bool edit)
|
||||
|
@ -210,15 +210,11 @@ typedef void *Ssh_gss_name;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Window handles for the windows that can be running during a
|
||||
* PuTTY session.
|
||||
* The all-important instance handle, saved from WinMain in every GUI
|
||||
* program and exported for other GUI code to pass back to the Windows
|
||||
* API.
|
||||
*/
|
||||
GLOBAL HWND hwnd; /* the main terminal window */
|
||||
|
||||
/*
|
||||
* The all-important instance handle.
|
||||
*/
|
||||
GLOBAL HINSTANCE hinst;
|
||||
extern HINSTANCE hinst;
|
||||
|
||||
/*
|
||||
* Help file stuff in winhelp.c.
|
||||
@ -230,15 +226,6 @@ void launch_help(HWND hwnd, const char *topic);
|
||||
void quit_help(HWND hwnd);
|
||||
int has_embedded_chm(void); /* 1 = yes, 0 = no, -1 = N/A */
|
||||
|
||||
/*
|
||||
* The terminal and logging context are notionally local to the
|
||||
* Windows front end, but they must be shared between window.c and
|
||||
* windlg.c. Likewise the Seat structure for the Windows GUI, and the
|
||||
* Conf for the main session..
|
||||
*/
|
||||
GLOBAL Terminal *term;
|
||||
GLOBAL LogContext *logctx;
|
||||
|
||||
/*
|
||||
* GUI seat methods in windlg.c, so that the vtable definition in
|
||||
* window.c can refer to them.
|
||||
@ -579,7 +566,7 @@ HWND event_log_window(void);
|
||||
/*
|
||||
* Exports from winmisc.c.
|
||||
*/
|
||||
GLOBAL DWORD osMajorVersion, osMinorVersion, osPlatformId;
|
||||
extern DWORD osMajorVersion, osMinorVersion, osPlatformId;
|
||||
void init_winver(void);
|
||||
void dll_hijacking_protection(void);
|
||||
HMODULE load_system32_dll(const char *libname);
|
||||
|
Loading…
x
Reference in New Issue
Block a user