[PATCH v2 1/4] Cygwin: console: Add workaround for broken IL/DL in xterm mode.
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Feb 28 14:45:00 GMT 2020
On Feb 28 14:31, Corinna Vinschen wrote:
> [CC Hans]
>
> On Feb 28 11:14, Takashi Yano wrote:
> > On Thu, 27 Feb 2020 18:03:47 +0000
> > Jon Turney wrote:
> > > > +#define wpbuf_put(x) \
> > > > + wpbuf[wpixput++] = x; \
> > > > + if (wpixput > WPBUF_LEN) \
> > > > + wpixput--;
> > > > +
> > >
> > > So I think either the macro need it contents contained by a 'do { ... }
> > > while(0)', or that instance of it needs to be surrounded by braces, to
> > > do what you intend.
> >
> > Thanks for the advice. Fortunately, "if" statement does not
> > cause a problem even if it is accidentally executed outside
> > "else" block in this case.
> >
> > Hans,
> > as for making a patch for this issue, may I leave it to you
> > because you are already working on it?
> >
> > --
> > Takashi Yano <takashi.yano@nifty.ne.jp>
What about an inline function instead?
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 64e12b8320a1..6c3e33818aca 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -63,10 +63,14 @@ 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) \
- wpbuf[wpixput++] = x; \
- if (wpixput > WPBUF_LEN) \
+
+static inline void
+wpbuf_put (unsigned char x)
+{
+ wpbuf[wpixput++] = x;
+ if (wpixput > WPBUF_LEN)
wpixput--;
+}
static void
beep ()
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20200228/d5e8f6e5/attachment.sig>
More information about the Cygwin-patches
mailing list