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

Make the backend_init error message dynamic. (NFC)

Now, instead of a 'const char *' in the static data segment, error
messages returned from backend setup are dynamically allocated and
freed by the caller.

This will allow me to make the messages much more specific (including
errno values and the like). However, this commit is pure refactoring:
I've _just_ changed the allocation policy, and left all the messages
alone.
This commit is contained in:
Simon Tatham
2020-04-18 13:28:33 +01:00
parent d9c4ce9fd8
commit df2994a05a
14 changed files with 88 additions and 87 deletions

10
putty.h
View File

@ -495,10 +495,10 @@ struct Backend {
const BackendVtable *vt;
};
struct BackendVtable {
const char *(*init) (const BackendVtable *vt, Seat *seat,
Backend **backend_out, LogContext *logctx, Conf *conf,
const char *host, int port,
char **realhost, bool nodelay, bool keepalive);
char *(*init) (const BackendVtable *vt, Seat *seat,
Backend **backend_out, LogContext *logctx, Conf *conf,
const char *host, int port, char **realhost,
bool nodelay, bool keepalive);
void (*free) (Backend *be);
/* Pass in a replacement configuration. */
@ -540,7 +540,7 @@ struct BackendVtable {
unsigned serial_parity_mask, serial_flow_mask;
};
static inline const char *backend_init(
static inline char *backend_init(
const BackendVtable *vt, Seat *seat, Backend **out, LogContext *logctx,
Conf *conf, const char *host, int port, char **rhost, bool nd, bool ka)
{ return vt->init(vt, seat, out, logctx, conf, host, port, rhost, nd, ka); }