[PATCH] Properly encapsulate multi-statement macro.

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Thu Feb 27 22:22:00 GMT 2020


On 2020-02-27 12:47, Hans-Bernhard Bröker wrote:
> 
>  winsup/cygwin/fhandler_console.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
> index 4ab9bcab8..353abd197 100644
> --- a/winsup/cygwin/fhandler_console.cc
> +++ b/winsup/cygwin/fhandler_console.cc
> @@ -63,10 +63,11 @@ static struct fhandler_base::rabuf_t con_ra;
>  static unsigned char wpbuf[WPBUF_LEN];
>  static int wpixput;
>  static unsigned char last_char;
> -#define wpbuf_put(x) \
> +#define wpbuf_put(x) do { \

Please split to avoid eye bleed:

  +#define wpbuf_put(x) \
  +do { \
>    wpbuf[wpixput++] = x; \
>    if (wpixput > WPBUF_LEN) \
> -    wpixput--;
> +    wpixput--; \
> +} while(0)
> 
>  static void
>  beep ()

and post to cygwin-patches?

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list