mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Move all extern declarations into header files.
This is another cleanup I felt a need for while I was doing boolification. If you define a function or variable in one .c file and declare it extern in another, then nothing will check you haven't got the types of the two declarations mismatched - so when you're _changing_ the type, it's a pain to make sure you've caught all the copies of it. It's better to put all those extern declarations in header files, so that the declaration in the header is also in scope for the definition. Then the compiler will complain if they don't match, which is what I want.
This commit is contained in:
@ -49,8 +49,6 @@ static char *events_initial[LOGEVENT_INITIAL_MAX];
|
||||
static char *events_circular[LOGEVENT_CIRCULAR_MAX];
|
||||
static int ninitial = 0, ncircular = 0, circular_first = 0;
|
||||
|
||||
extern Conf *conf; /* defined in window.c */
|
||||
|
||||
#define PRINTER_DISABLED_STRING "None (printing disabled)"
|
||||
|
||||
void force_normal(HWND hwnd)
|
||||
@ -799,7 +797,6 @@ static void win_gui_eventlog(LogPolicy *lp, const char *string)
|
||||
|
||||
static void win_gui_logging_error(LogPolicy *lp, const char *event)
|
||||
{
|
||||
extern Seat win_seat[1];
|
||||
/* Send 'can't open log file' errors to the terminal window.
|
||||
* (Marked as stderr, although terminal.c won't care.) */
|
||||
seat_stderr(win_seat, event, strlen(event));
|
||||
|
@ -152,8 +152,6 @@ struct wm_netevent_params {
|
||||
LPARAM lParam;
|
||||
};
|
||||
|
||||
Conf *conf; /* exported to windlg.c */
|
||||
|
||||
static void conf_cache_data(void);
|
||||
int cursor_type;
|
||||
int vtmode;
|
||||
@ -349,7 +347,8 @@ static const SeatVtable win_seat_vt = {
|
||||
nullseat_get_windowid,
|
||||
win_seat_get_window_pixel_size,
|
||||
};
|
||||
Seat win_seat[1] = {{ &win_seat_vt }};
|
||||
static Seat win_seat_impl = { &win_seat_vt };
|
||||
Seat *const win_seat = &win_seat_impl;
|
||||
|
||||
static void start_backend(void)
|
||||
{
|
||||
|
@ -839,8 +839,6 @@ static void sk_net_set_frozen(Socket *s, bool is_frozen);
|
||||
static const char *sk_net_socket_error(Socket *s);
|
||||
static SocketPeerInfo *sk_net_peer_info(Socket *s);
|
||||
|
||||
extern char *do_select(SOCKET skt, bool startup);
|
||||
|
||||
static const SocketVtable NetSocket_sockvt = {
|
||||
sk_net_plug,
|
||||
sk_net_close,
|
||||
@ -1790,7 +1788,7 @@ SOCKET next_socket(int *state)
|
||||
return s ? s->s : INVALID_SOCKET;
|
||||
}
|
||||
|
||||
extern bool socket_writable(SOCKET skt)
|
||||
bool socket_writable(SOCKET skt)
|
||||
{
|
||||
NetSocket *s = find234(sktree, (void *)skt, cmpforsearch);
|
||||
|
||||
|
@ -15,9 +15,6 @@
|
||||
|
||||
#include "winsecur.h"
|
||||
|
||||
Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
|
||||
Plug *plug, bool overlapped);
|
||||
|
||||
Socket *new_named_pipe_client(const char *pipename, Plug *plug)
|
||||
{
|
||||
HANDLE pipehandle;
|
||||
|
@ -15,9 +15,6 @@
|
||||
|
||||
#include "winsecur.h"
|
||||
|
||||
Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
|
||||
Plug *plug, bool overlapped);
|
||||
|
||||
typedef struct NamedPipeServerSocket {
|
||||
/* Parameters for (repeated) creation of named pipe objects */
|
||||
PSECURITY_DESCRIPTOR psd;
|
||||
@ -120,12 +117,6 @@ static Socket *named_pipe_accept(accept_ctx_t ctx, Plug *plug)
|
||||
return make_handle_socket(conn, conn, NULL, plug, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dummy SockAddr *type which just holds a named pipe address. Only
|
||||
* used for calling plug_log from named_pipe_accept_loop() here.
|
||||
*/
|
||||
SockAddr *sk_namedpipe_addr(const char *pipename);
|
||||
|
||||
static void named_pipe_accept_loop(NamedPipeServerSocket *ps,
|
||||
bool got_one_already)
|
||||
{
|
||||
|
@ -137,8 +137,6 @@ static void progress_update(void *param, int action, int phase, int iprogress)
|
||||
}
|
||||
}
|
||||
|
||||
extern const char ver[];
|
||||
|
||||
struct PassphraseProcStruct {
|
||||
char **passphrase;
|
||||
char *comment;
|
||||
|
@ -50,8 +50,6 @@
|
||||
|
||||
#define APPNAME "Pageant"
|
||||
|
||||
extern const char ver[];
|
||||
|
||||
static HWND keylist;
|
||||
static HWND aboutbox;
|
||||
static HMENU systray_menu, session_menu;
|
||||
|
@ -530,7 +530,6 @@ int main(int argc, char **argv)
|
||||
} else if (n == WAIT_OBJECT_0 + nhandles) {
|
||||
WSANETWORKEVENTS things;
|
||||
SOCKET socket;
|
||||
extern SOCKET first_socket(int *), next_socket(int *);
|
||||
int i, socketstate;
|
||||
|
||||
/*
|
||||
|
@ -12,9 +12,6 @@
|
||||
#include "network.h"
|
||||
#include "proxy.h"
|
||||
|
||||
Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
|
||||
Plug *plug, bool overlapped);
|
||||
|
||||
Socket *platform_new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
|
@ -535,7 +535,6 @@ int do_eventsel_loop(HANDLE other_event)
|
||||
} else if (netindex >= 0 && n == WAIT_OBJECT_0 + netindex) {
|
||||
WSANETWORKEVENTS things;
|
||||
SOCKET socket;
|
||||
extern SOCKET first_socket(int *), next_socket(int *);
|
||||
int i, socketstate;
|
||||
|
||||
/*
|
||||
|
@ -115,9 +115,6 @@ static char *make_name(const char *prefix, const char *name)
|
||||
return retname;
|
||||
}
|
||||
|
||||
Socket *new_named_pipe_client(const char *pipename, Plug *plug);
|
||||
Socket *new_named_pipe_listener(const char *pipename, Plug *plug);
|
||||
|
||||
int platform_ssh_share(const char *pi_name, Conf *conf,
|
||||
Plug *downplug, Plug *upplug, Socket **sock,
|
||||
char **logtext, char **ds_err, char **us_err,
|
||||
|
@ -235,13 +235,16 @@ void quit_help(HWND hwnd);
|
||||
/*
|
||||
* 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.
|
||||
* windlg.c. Likewise the Seat structure for the Windows GUI, and the
|
||||
* Conf for the main session..
|
||||
*/
|
||||
GLOBAL Terminal *term;
|
||||
GLOBAL LogContext *logctx;
|
||||
GLOBAL Conf *conf;
|
||||
|
||||
/*
|
||||
* GUI seat methods in windlg.c.
|
||||
* GUI seat methods in windlg.c, so that the vtable definition in
|
||||
* window.c can refer to them.
|
||||
*/
|
||||
int win_seat_verify_ssh_host_key(
|
||||
Seat *seat, const char *host, int port,
|
||||
@ -254,6 +257,12 @@ int win_seat_confirm_weak_cached_hostkey(
|
||||
Seat *seat, const char *algname, const char *betteralgs,
|
||||
void (*callback)(void *ctx, int result), void *ctx);
|
||||
|
||||
/*
|
||||
* The Windows GUI seat object itself, so that its methods can be
|
||||
* called outside window.c.
|
||||
*/
|
||||
extern Seat *const win_seat;
|
||||
|
||||
/*
|
||||
* Windows-specific clipboard helper function shared with windlg.c,
|
||||
* which takes the data string in the system code page instead of
|
||||
@ -303,7 +312,17 @@ void write_aclip(int clipboard, char *, int, bool);
|
||||
/*
|
||||
* Exports from winnet.c.
|
||||
*/
|
||||
extern void select_result(WPARAM, LPARAM);
|
||||
/* Report an event notification from WSA*Select */
|
||||
void select_result(WPARAM, LPARAM);
|
||||
/* Enumerate all currently live OS-level SOCKETs */
|
||||
SOCKET first_socket(int *);
|
||||
SOCKET next_socket(int *);
|
||||
/* Ask winnet.c whether we currently want to try to write to a SOCKET */
|
||||
bool socket_writable(SOCKET skt);
|
||||
/* Force a refresh of the SOCKET list by re-calling do_select for each one */
|
||||
void socket_reselect_all(void);
|
||||
/* Make a SockAddr which just holds a named pipe address. */
|
||||
SockAddr *sk_namedpipe_addr(const char *pipename);
|
||||
|
||||
/*
|
||||
* winnet.c dynamically loads WinSock 2 or WinSock 1 depending on
|
||||
@ -331,9 +350,19 @@ DECL_WINDOWS_FUNCTION(GLOBAL, int, select,
|
||||
fd_set FAR *, const struct timeval FAR *));
|
||||
#endif
|
||||
|
||||
extern bool socket_writable(SOCKET skt);
|
||||
/*
|
||||
* Provided by each client of winnet.c, and called by winnet.c to turn
|
||||
* on or off WSA*Select for a given socket.
|
||||
*/
|
||||
char *do_select(SOCKET skt, bool startup);
|
||||
|
||||
extern void socket_reselect_all(void);
|
||||
/*
|
||||
* Network-subsystem-related functions provided in other Windows modules.
|
||||
*/
|
||||
Socket *make_handle_socket(HANDLE send_H, HANDLE recv_H, HANDLE stderr_H,
|
||||
Plug *plug, bool overlapped); /* winhsock */
|
||||
Socket *new_named_pipe_client(const char *pipename, Plug *plug); /* winnpc */
|
||||
Socket *new_named_pipe_listener(const char *pipename, Plug *plug); /* winnps */
|
||||
|
||||
/*
|
||||
* Exports from winctrls.c.
|
||||
|
Reference in New Issue
Block a user