1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 09:37:34 -05:00

Get rid of the error-return mechanism from x11_init.

Now that it doesn't actually make a network connection because that's
deferred until after the X authorisation exchange, there's no point in
having it return an error message and write the real output through a
pointer argument. Instead, we can just have it return xconn directly
and simplify the call sites.

[originally from svn r10081]
This commit is contained in:
Simon Tatham
2013-11-17 14:05:23 +00:00
parent 94e8f97d3f
commit e5a3e28eec
3 changed files with 25 additions and 44 deletions

View File

@ -649,14 +649,11 @@ int x11_get_screen_number(char *display)
}
/*
* Called to set up the raw connection.
*
* On success, returns NULL and fills in *xconnret. On error, returns
* a dynamically allocated error message string.
* Called to set up the X11Connection structure, though this does not
* yet connect to an actual server.
*/
extern char *x11_init(struct X11Connection **xconnret,
tree234 *authtree, void *c,
const char *peeraddr, int peerport)
struct X11Connection *x11_init(tree234 *authtree, void *c,
const char *peeraddr, int peerport)
{
static const struct plug_function_table fn_table = {
x11_log,
@ -671,7 +668,7 @@ extern char *x11_init(struct X11Connection **xconnret,
/*
* Open socket.
*/
xconn = *xconnret = snew(struct X11Connection);
xconn = snew(struct X11Connection);
xconn->fn = &fn_table;
xconn->auth_protocol = NULL;
xconn->authtree = authtree;
@ -698,7 +695,7 @@ extern char *x11_init(struct X11Connection **xconnret,
xconn->peer_addr = peeraddr ? dupstr(peeraddr) : NULL;
xconn->peer_port = peerport;
return NULL;
return xconn;
}
void x11_close(struct X11Connection *xconn)