From 59c8df413088a1f3a04f3b1a0487b908c44540bd Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 28 Feb 2019 18:05:38 +0000 Subject: [PATCH] Remove duplicate coroutine macros. pageant.c and sshshare.c each had an extra copy of crBegin and crFinishV, dating from when the main versions were kept in ssh.c where they couldn't be conveniently #included by other modules. Now they're in sshcr.h, where they can be, so there's no need to have extra copies of them anywhere. (But I've left the crGetChar macro in each of those files, because those really are specific to the particular context, referring to an extra variable that clients of the more general sshcr.h macros won't all have.) --- pageant.c | 6 +++--- sshshare.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pageant.c b/pageant.c index 446790a0..99c4bbe4 100644 --- a/pageant.c +++ b/pageant.c @@ -9,6 +9,7 @@ #include "putty.h" #include "mpint.h" #include "ssh.h" +#include "sshcr.h" #include "pageant.h" /* @@ -703,10 +704,9 @@ bool pageant_delete_ssh2_key(ssh2_userkey *skey) */ /* - * Coroutine macros similar to, but simplified from, those in ssh.c. + * An extra coroutine macro, specific to this code which is consuming + * 'const char *data'. */ -#define crBegin(v) { int *crLine = &v; switch(v) { case 0:; -#define crFinishV } *crLine = 0; return; } #define crGetChar(c) do \ { \ while (len == 0) { \ diff --git a/sshshare.c b/sshshare.c index 04301656..2e2cf367 100644 --- a/sshshare.c +++ b/sshshare.c @@ -138,6 +138,7 @@ #include "putty.h" #include "tree234.h" #include "ssh.h" +#include "sshcr.h" struct ssh_sharing_state { char *sockname; /* the socket name, kept for cleanup */ @@ -1741,10 +1742,9 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs, } /* - * Coroutine macros similar to, but simplified from, those in ssh.c. + * An extra coroutine macro, specific to this code which is consuming + * 'const char *data'. */ -#define crBegin(v) { int *crLine = &v; switch(v) { case 0:; -#define crFinishV } *crLine = 0; return; } #define crGetChar(c) do \ { \ while (len == 0) { \