1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Centralise stub plug/socket functions.

In the previous few commits I noticed some repeated work in the form
of pointless empty implementations of Plug's log method, plus some
existing (and some new) empty cases of Socket's endpoint_info. As a
cleanup, I'm replacing as many as I can find with uses of a central
null implementation in the stubs directory.
This commit is contained in:
Simon Tatham
2024-06-29 12:07:59 +01:00
parent 7618e079f5
commit 807ed08da0
12 changed files with 38 additions and 81 deletions

View File

@ -315,11 +315,6 @@ static void fdsocket_select_result_input_error(int fd, int event)
}
}
static SocketEndpointInfo *fdsocket_endpoint_info(Socket *s, bool peer)
{
return NULL;
}
static const SocketVtable FdSocket_sockvt = {
.plug = fdsocket_plug,
.close = fdsocket_close,
@ -328,7 +323,7 @@ static const SocketVtable FdSocket_sockvt = {
.write_eof = fdsocket_write_eof,
.set_frozen = fdsocket_set_frozen,
.socket_error = fdsocket_socket_error,
.endpoint_info = fdsocket_endpoint_info,
.endpoint_info = nullsock_endpoint_info,
};
static void fdsocket_connect_success_callback(void *ctx)

View File

@ -237,18 +237,12 @@ void keylist_update(void)
static bool time_to_die = false;
/*
* These functions are part of the plug for our connection to the X
* display, so they do get called. They needn't actually do anything,
* except that x11_closing has to signal back to the main loop that
* it's time to terminate.
*/
static void x11_log(Plug *p, Socket *s, PlugLogType type, SockAddr *addr,
int port, const char *error_msg, int error_code) {}
static void x11_receive(Plug *plug, int urgent, const char *data, size_t len) {}
static void x11_sent(Plug *plug, size_t bufsize) {}
static void x11_closing(Plug *plug, PlugCloseType type, const char *error_msg)
{
/*
* When the X connection closes, signal back to the main loop that
* it's time to terminate.
*/
time_to_die = true;
}
struct X11Connection {
@ -994,10 +988,10 @@ void run_client(void)
}
static const PlugVtable X11Connection_plugvt = {
.log = x11_log,
.log = nullplug_log,
.closing = x11_closing,
.receive = x11_receive,
.sent = x11_sent,
.receive = nullplug_receive,
.sent = nullplug_sent,
};