mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Move default_protocol and default_port into settings.c.
These global variables are only ever used by load_settings, which uses them to vary the default protocol and port number in the absence of any specification elsewhere. So there's no real need for them to be universally accessible via the awkward GLOBAL mechanism: they can be statics inside settings.c, with accessor functions that can set them. That was the last GLOBAL in putty.h, so I've removed the definition of the macro GLOBAL itself as well. There are still some GLOBALs in the Windows subdirectory, though.
This commit is contained in:
@ -532,14 +532,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
char *p;
|
||||
bool special_launchable_argument = false;
|
||||
|
||||
default_protocol = be_default_protocol;
|
||||
settings_set_default_protocol(be_default_protocol);
|
||||
/* Find the appropriate default port. */
|
||||
{
|
||||
const struct BackendVtable *vt =
|
||||
backend_vt_from_proto(default_protocol);
|
||||
default_port = 0; /* illegal */
|
||||
backend_vt_from_proto(be_default_protocol);
|
||||
settings_set_default_port(0); /* illegal */
|
||||
if (vt)
|
||||
default_port = vt->default_port;
|
||||
settings_set_default_port(vt->default_port);
|
||||
}
|
||||
conf_set_int(conf, CONF_logtype, LGTYP_NONE);
|
||||
|
||||
|
@ -252,16 +252,16 @@ int main(int argc, char **argv)
|
||||
* Initialise port and protocol to sensible defaults. (These
|
||||
* will be overridden by more or less anything.)
|
||||
*/
|
||||
default_protocol = PROT_SSH;
|
||||
default_port = 22;
|
||||
settings_set_default_protocol(PROT_SSH);
|
||||
settings_set_default_port(22);
|
||||
|
||||
/*
|
||||
* Process the command line.
|
||||
*/
|
||||
conf = conf_new();
|
||||
do_defaults(NULL, conf);
|
||||
default_protocol = conf_get_int(conf, CONF_protocol);
|
||||
default_port = conf_get_int(conf, CONF_port);
|
||||
settings_set_default_protocol(conf_get_int(conf, CONF_protocol));
|
||||
settings_set_default_port(conf_get_int(conf, CONF_port));
|
||||
errors = false;
|
||||
{
|
||||
/*
|
||||
@ -271,10 +271,10 @@ int main(int argc, char **argv)
|
||||
if (p) {
|
||||
const struct BackendVtable *vt = backend_vt_from_name(p);
|
||||
if (vt) {
|
||||
default_protocol = vt->protocol;
|
||||
default_port = vt->default_port;
|
||||
conf_set_int(conf, CONF_protocol, default_protocol);
|
||||
conf_set_int(conf, CONF_port, default_port);
|
||||
settings_set_default_protocol(vt->protocol);
|
||||
settings_set_default_port(vt->default_port);
|
||||
conf_set_int(conf, CONF_protocol, vt->protocol);
|
||||
conf_set_int(conf, CONF_port, vt->default_port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user