1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-06 22:12:47 -05:00

Get rid of lots of implicit pointer types.

All the main backend structures - Ssh, Telnet, Pty, Serial etc - now
describe structure types themselves rather than pointers to them. The
same goes for the codebase-wide trait types Socket and Plug, and the
supporting types SockAddr and Pinger.

All those things that were typedefed as pointers are older types; the
newer ones have the explicit * at the point of use, because that's
what I now seem to be preferring. But whichever one of those is
better, inconsistently using a mixture of the two styles is worse, so
let's make everything consistent.

A few types are still implicitly pointers, such as Bignum and some of
the GSSAPI types; generally this is either because they have to be
void *, or because they're typedefed differently on different
platforms and aren't always pointers at all. Can't be helped. But I've
got rid of the main ones, at least.
This commit is contained in:
Simon Tatham
2018-10-04 19:10:23 +01:00
parent bf61af1919
commit 96ec2c2500
42 changed files with 595 additions and 596 deletions

View File

@ -20,7 +20,7 @@ typedef struct LocalProxySocket {
char *error;
Plug plug;
Plug *plug;
bufchain pending_output_data;
bufchain pending_input_data;
@ -103,16 +103,16 @@ static int localproxy_errfd_find(void *av, void *bv)
/* basic proxy socket functions */
static Plug sk_localproxy_plug (Socket s, Plug p)
static Plug *sk_localproxy_plug (Socket *s, Plug *p)
{
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
Plug ret = ps->plug;
Plug *ret = ps->plug;
if (p)
ps->plug = p;
return ret;
}
static void sk_localproxy_close (Socket s)
static void sk_localproxy_close (Socket *s)
{
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
@ -200,7 +200,7 @@ static int localproxy_try_send(LocalProxySocket *ps)
return sent;
}
static int sk_localproxy_write (Socket s, const void *data, int len)
static int sk_localproxy_write (Socket *s, const void *data, int len)
{
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
@ -213,7 +213,7 @@ static int sk_localproxy_write (Socket s, const void *data, int len)
return bufchain_size(&ps->pending_output_data);
}
static int sk_localproxy_write_oob (Socket s, const void *data, int len)
static int sk_localproxy_write_oob (Socket *s, const void *data, int len)
{
/*
* oob data is treated as inband; nasty, but nothing really
@ -222,7 +222,7 @@ static int sk_localproxy_write_oob (Socket s, const void *data, int len)
return sk_localproxy_write(s, data, len);
}
static void sk_localproxy_write_eof (Socket s)
static void sk_localproxy_write_eof (Socket *s)
{
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
@ -232,13 +232,13 @@ static void sk_localproxy_write_eof (Socket s)
localproxy_try_send(ps);
}
static void sk_localproxy_flush (Socket s)
static void sk_localproxy_flush (Socket *s)
{
/* LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt); */
/* do nothing */
}
static void sk_localproxy_set_frozen (Socket s, int is_frozen)
static void sk_localproxy_set_frozen (Socket *s, int is_frozen)
{
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
@ -251,7 +251,7 @@ static void sk_localproxy_set_frozen (Socket s, int is_frozen)
uxsel_set(ps->from_cmd, 1, localproxy_select_result);
}
static const char * sk_localproxy_socket_error (Socket s)
static const char * sk_localproxy_socket_error (Socket *s)
{
LocalProxySocket *ps = FROMFIELD(s, LocalProxySocket, sockvt);
return ps->error;
@ -315,10 +315,10 @@ static const Socket_vtable LocalProxySocket_sockvt = {
NULL, /* peer_info */
};
Socket platform_new_connection(SockAddr addr, const char *hostname,
int port, int privport,
int oobinline, int nodelay, int keepalive,
Plug plug, Conf *conf)
Socket *platform_new_connection(SockAddr *addr, const char *hostname,
int port, int privport,
int oobinline, int nodelay, int keepalive,
Plug *plug, Conf *conf)
{
char *cmd;