commit e6afdd05c4e48ae05a1f9eadea368ce51edf56f0
parent 3fa6933615686fc91a7b7917d8326642dc5b51da
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Fri, 1 Jan 2010 13:10:47 -0800
check NCURSES_OPAQUE to see if we can dereference a WINDOW pointer
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
@@ -814,7 +814,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
int halfdelay = NUM2INT(rb_iv_get(mNcurses, "@halfdelay"));
int infd = NUM2INT(rb_iv_get(mNcurses, "@infd"));
double screen_delay = halfdelay * 0.1;
-#ifdef NCURSES_VERSION
+#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
int windelay = c_win->_delay;
#else
int windelay = 0;
@@ -831,7 +831,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
gettimeofday(&tv, &tz);
starttime = tv.tv_sec + tv.tv_usec * 1e-6;
finishtime = starttime + delay;
-#ifdef NCURSES_VERSION
+#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
c_win->_delay = 0;
#endif
while (doupdate() /* detects resize */, (result = wgetch(c_win)) == ERR) {
@@ -850,7 +850,7 @@ static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
FD_SET(infd, &in_fds);
rb_thread_select(infd + 1, &in_fds, NULL, NULL, &tv);
}
-#ifdef NCURSES_VERSION
+#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
c_win->_delay = windelay;
#endif
return result;