1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42:48 -05:00

Pass the BackendVtable pointer to backend_init.

Now I can have multiple BackendVtable structures sharing all their
function pointers, and still tell which is which when init is setting
things up.
This commit is contained in:
Simon Tatham
2020-02-16 11:43:20 +00:00
parent 91c2e6b4d5
commit 0a09c12edc
9 changed files with 50 additions and 47 deletions

View File

@ -1268,9 +1268,9 @@ Backend *pty_backend_create(
* it gets the argv array from the global variable pty_argv, expecting
* that it will have been invoked by pterm.
*/
static const char *pty_init(Seat *seat, Backend **backend_handle,
LogContext *logctx, Conf *conf,
const char *host, int port,
static const char *pty_init(const BackendVtable *vt, Seat *seat,
Backend **backend_handle, LogContext *logctx,
Conf *conf, const char *host, int port,
char **realhost, bool nodelay, bool keepalive)
{
const char *cmd = NULL;
@ -1281,7 +1281,8 @@ static const char *pty_init(Seat *seat, Backend **backend_handle,
if (pty_argv && pty_argv[0] && !pty_argv[1])
cmd = pty_argv[0];
*backend_handle= pty_backend_create(
assert(vt == &pty_backend);
*backend_handle = pty_backend_create(
seat, logctx, conf, pty_argv, cmd, modes, false, NULL, NULL);
*realhost = dupstr("");
return NULL;

View File

@ -279,10 +279,10 @@ static const char *serial_configure(Serial *serial, Conf *conf)
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *serial_init(Seat *seat, Backend **backend_handle,
LogContext *logctx, Conf *conf,
const char *host, int port, char **realhost,
bool nodelay, bool keepalive)
static const char *serial_init(const BackendVtable *vt, Seat *seat,
Backend **backend_handle, LogContext *logctx,
Conf *conf, const char *host, int port,
char **realhost, bool nodelay, bool keepalive)
{
Serial *serial;
const char *err;
@ -292,7 +292,7 @@ static const char *serial_init(Seat *seat, Backend **backend_handle,
seat_set_trust_status(seat, false);
serial = snew(Serial);
serial->backend.vt = &serial_backend;
serial->backend.vt = vt;
*backend_handle = &serial->backend;
serial->seat = seat;