1
0
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:
Simon Tatham
2020-02-02 10:00:42 +00:00
parent e9c3f1ca6d
commit 46fc31c062
9 changed files with 53 additions and 66 deletions

23
putty.h
View File

@ -4,19 +4,6 @@
#include <stddef.h> /* for wchar_t */
#include <limits.h> /* for INT_MAX */
/*
* Global variables. Most modules declare these `extern', but
* window.c will do `#define PUTTY_DO_GLOBALS' before including this
* module, and so will get them properly defined.
*/
#ifndef GLOBAL
#ifdef PUTTY_DO_GLOBALS
#define GLOBAL
#else
#define GLOBAL extern
#endif
#endif
#include "defs.h"
#include "puttyps.h"
#include "network.h"
@ -578,14 +565,6 @@ extern const int be_default_protocol;
*/
extern const char *const appname;
/*
* Likewise, these two variables are set up when the application
* initialises, and inform all default-settings accesses after
* that.
*/
GLOBAL int default_protocol;
GLOBAL int default_port;
/*
* Mechanism for getting text strings such as usernames and passwords
* from the front-end.
@ -1562,6 +1541,8 @@ void load_open_settings(settings_r *sesskey, Conf *conf);
void get_sesslist(struct sesslist *, bool allocate);
bool do_defaults(const char *, Conf *);
void registry_cleanup(void);
void settings_set_default_protocol(int);
void settings_set_default_port(int);
/*
* Functions used by settings.c to provide platform-specific