mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-14 01:27:35 -05:00
Start using C99 variadic macros.
In the past, I've had a lot of macros which you call with double parentheses, along the lines of debug(("format string", params)), so that the inner parens protect the commas and permit the macro to treat the whole printf-style argument list as one macro argument. That's all very well, but it's a bit inconvenient (it doesn't leave you any way to implement such a macro by prepending another argument to the list), and now this code base's rules allow C99isms, I can switch all those macros to using a single pair of parens, using the C99 ability to say '...' in the parameter list of the #define and get at the corresponding suffix of the arguments as __VA_ARGS__. So I'm doing it. I've made the following printf-style macros variadic: bpp_logevent, ppl_logevent, ppl_printf and debug. While I'm here, I've also fixed up a collection of conditioned-out calls to debug() in the Windows front end which were clearly expecting a macro with a different calling syntax, because they had an integer parameter first. If I ever have a need to condition those back in, they should actually work now.
This commit is contained in:
@ -126,7 +126,7 @@ bool ssh1_handle_direction_specific_packet(
|
||||
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_FAILURE);
|
||||
put_uint32(pktout, remid);
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
ppl_logevent(("Rejected X11 connect request"));
|
||||
ppl_logevent("Rejected X11 connect request");
|
||||
} else {
|
||||
c = snew(struct ssh1_channel);
|
||||
c->connlayer = s;
|
||||
@ -142,7 +142,7 @@ bool ssh1_handle_direction_specific_packet(
|
||||
put_uint32(pktout, c->remoteid);
|
||||
put_uint32(pktout, c->localid);
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
ppl_logevent(("Opened X11 forward channel"));
|
||||
ppl_logevent("Opened X11 forward channel");
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -183,8 +183,8 @@ bool ssh1_handle_direction_specific_packet(
|
||||
pfp = find234(s->rportfwds, &pf, NULL);
|
||||
|
||||
if (!pfp) {
|
||||
ppl_logevent(("Rejected remote port open request for %s:%d",
|
||||
pf.dhost, port));
|
||||
ppl_logevent("Rejected remote port open request for %s:%d",
|
||||
pf.dhost, port);
|
||||
pktout = ssh_bpp_new_pktout(
|
||||
s->ppl.bpp, SSH1_MSG_CHANNEL_OPEN_FAILURE);
|
||||
put_uint32(pktout, remid);
|
||||
@ -194,14 +194,14 @@ bool ssh1_handle_direction_specific_packet(
|
||||
|
||||
c = snew(struct ssh1_channel);
|
||||
c->connlayer = s;
|
||||
ppl_logevent(("Received remote port open request for %s:%d",
|
||||
pf.dhost, port));
|
||||
ppl_logevent("Received remote port open request for %s:%d",
|
||||
pf.dhost, port);
|
||||
err = portfwdmgr_connect(
|
||||
s->portfwdmgr, &c->chan, pf.dhost, port,
|
||||
&c->sc, pfp->addressfamily);
|
||||
|
||||
if (err) {
|
||||
ppl_logevent(("Port open failed: %s", err));
|
||||
ppl_logevent("Port open failed: %s", err);
|
||||
sfree(err);
|
||||
ssh1_channel_free(c);
|
||||
pktout = ssh_bpp_new_pktout(
|
||||
@ -217,7 +217,7 @@ bool ssh1_handle_direction_specific_packet(
|
||||
put_uint32(pktout, c->remoteid);
|
||||
put_uint32(pktout, c->localid);
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
ppl_logevent(("Forwarded port opened successfully"));
|
||||
ppl_logevent("Forwarded port opened successfully");
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ bool ssh1_handle_direction_specific_packet(
|
||||
case SSH1_SMSG_EXIT_STATUS:
|
||||
{
|
||||
int exitcode = get_uint32(pktin);
|
||||
ppl_logevent(("Server sent command exit status %d", exitcode));
|
||||
ppl_logevent("Server sent command exit status %d", exitcode);
|
||||
ssh_got_exitcode(s->ppl.ssh, exitcode);
|
||||
|
||||
s->session_terminated = true;
|
||||
@ -468,11 +468,11 @@ static void ssh1_rportfwd_response(struct ssh1_connection_state *s,
|
||||
struct ssh_rportfwd *rpf = (struct ssh_rportfwd *)ctx;
|
||||
|
||||
if (success) {
|
||||
ppl_logevent(("Remote port forwarding from %s enabled",
|
||||
rpf->log_description));
|
||||
ppl_logevent("Remote port forwarding from %s enabled",
|
||||
rpf->log_description);
|
||||
} else {
|
||||
ppl_logevent(("Remote port forwarding from %s refused",
|
||||
rpf->log_description));
|
||||
ppl_logevent("Remote port forwarding from %s refused",
|
||||
rpf->log_description);
|
||||
|
||||
struct ssh_rportfwd *realpf = del234(s->rportfwds, rpf);
|
||||
assert(realpf == rpf);
|
||||
|
Reference in New Issue
Block a user