mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 22:12:47 -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:
@ -66,7 +66,7 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
|
||||
* waiting for the group request.
|
||||
*/
|
||||
if (dh_is_gex(s->kex_alg)) {
|
||||
ppl_logevent(("Doing Diffie-Hellman group exchange"));
|
||||
ppl_logevent("Doing Diffie-Hellman group exchange");
|
||||
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_DHGEX;
|
||||
|
||||
crMaybeWaitUntilV((pktin = ssh2_transport_pop(s)) != NULL);
|
||||
@ -111,12 +111,12 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
|
||||
s->dh_ctx = dh_setup_group(s->kex_alg);
|
||||
s->kex_init_value = SSH2_MSG_KEXDH_INIT;
|
||||
s->kex_reply_value = SSH2_MSG_KEXDH_REPLY;
|
||||
ppl_logevent(("Using Diffie-Hellman with standard group \"%s\"",
|
||||
s->kex_alg->groupname));
|
||||
ppl_logevent("Using Diffie-Hellman with standard group \"%s\"",
|
||||
s->kex_alg->groupname);
|
||||
}
|
||||
|
||||
ppl_logevent(("Doing Diffie-Hellman key exchange with hash %s",
|
||||
s->kex_alg->hash->text_name));
|
||||
ppl_logevent("Doing Diffie-Hellman key exchange with hash %s",
|
||||
s->kex_alg->hash->text_name);
|
||||
|
||||
/*
|
||||
* Generate e for Diffie-Hellman.
|
||||
@ -179,9 +179,9 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
|
||||
freebn(s->p); s->p = NULL;
|
||||
}
|
||||
} else if (s->kex_alg->main_type == KEXTYPE_ECDH) {
|
||||
ppl_logevent(("Doing ECDH key exchange with curve %s and hash %s",
|
||||
ssh_ecdhkex_curve_textname(s->kex_alg),
|
||||
s->kex_alg->hash->text_name));
|
||||
ppl_logevent("Doing ECDH key exchange with curve %s and hash %s",
|
||||
ssh_ecdhkex_curve_textname(s->kex_alg),
|
||||
s->kex_alg->hash->text_name);
|
||||
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_ECDHKEX;
|
||||
|
||||
s->ecdh_key = ssh_ecdhkex_newkey(s->kex_alg);
|
||||
@ -230,8 +230,8 @@ void ssh2kex_coroutine(struct ssh2_transport_state *s)
|
||||
ssh_sw_abort(s->ppl.ssh, "GSS key exchange not supported in server");
|
||||
} else {
|
||||
assert(s->kex_alg->main_type == KEXTYPE_RSA);
|
||||
ppl_logevent(("Doing RSA key exchange with hash %s",
|
||||
s->kex_alg->hash->text_name));
|
||||
ppl_logevent("Doing RSA key exchange with hash %s",
|
||||
s->kex_alg->hash->text_name);
|
||||
s->ppl.bpp->pls->kctx = SSH2_PKTCTX_RSAKEX;
|
||||
|
||||
{
|
||||
|
Reference in New Issue
Block a user