mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-17 02:57:33 -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:
@ -407,8 +407,8 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
|
||||
put_stringz(pktout, chanopen_result.u.failure.wire_message);
|
||||
put_stringz(pktout, "en"); /* language tag */
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
ppl_logevent(("Rejected channel open: %s",
|
||||
chanopen_result.u.failure.wire_message));
|
||||
ppl_logevent("Rejected channel open: %s",
|
||||
chanopen_result.u.failure.wire_message);
|
||||
sfree(chanopen_result.u.failure.wire_message);
|
||||
sfree(c);
|
||||
} else {
|
||||
@ -685,8 +685,7 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
|
||||
bs_modes, encoded_modes.ptr, encoded_modes.len);
|
||||
modes = read_ttymodes_from_packet(bs_modes, 2);
|
||||
if (get_err(bs_modes) || get_avail(bs_modes) > 0) {
|
||||
ppl_logevent(("Unable to decode terminal mode "
|
||||
"string"));
|
||||
ppl_logevent("Unable to decode terminal mode string");
|
||||
reply_success = false;
|
||||
} else {
|
||||
reply_success = chan_allocate_pty(
|
||||
@ -1151,7 +1150,7 @@ static void ssh2_channel_close_local(struct ssh2_channel *c,
|
||||
msg = chan_log_close_msg(c->chan);
|
||||
|
||||
if (msg)
|
||||
ppl_logevent(("%s%s%s", msg, reason ? " " : "", reason ? reason : ""));
|
||||
ppl_logevent("%s%s%s", msg, reason ? " " : "", reason ? reason : "");
|
||||
|
||||
sfree(msg);
|
||||
|
||||
|
Reference in New Issue
Block a user