libncurses: Import https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz changes

Change-Id: I3433d30ca01359fd2e3623ede96b531f0b39cbfa
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/ncurses/base/lib_window.c b/ncurses/base/lib_window.c
index 4baa369..5323fbf 100644
--- a/ncurses/base/lib_window.c
+++ b/ncurses/base/lib_window.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +40,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_window.c,v 1.29 2010/12/19 01:47:22 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.32 2021/10/23 23:06:24 tom Exp $")
 
 NCURSES_EXPORT(void)
 _nc_synchook(WINDOW *win)
@@ -56,7 +57,6 @@
 /* move a derived window */
 {
     WINDOW *orig;
-    int i;
     int rc = ERR;
 
     T((T_CALLED("mvderwin(%p,%d,%d)"), (void *) win, y, x));
@@ -66,6 +66,8 @@
 	&& (x >= 0 && y >= 0)
 	&& (x + getmaxx(win) <= getmaxx(orig))
 	&& (y + getmaxy(win) <= getmaxy(orig))) {
+	int i;
+
 	wsyncup(win);
 	win->_parx = x;
 	win->_pary = y;
@@ -128,7 +130,7 @@
 {
     T((T_CALLED("wsyncdown(%p)"), (void *) win));
 
-    if (win && win->_parent) {
+    if (win != NULL && win->_parent != NULL) {
 	WINDOW *pp = win->_parent;
 	int y;
 
@@ -177,8 +179,6 @@
 /* make an exact duplicate of the given window */
 {
     WINDOW *nwin = 0;
-    size_t linesize;
-    int i;
 
     T((T_CALLED("dupwin(%p)"), (void *) win));
 
@@ -187,7 +187,7 @@
 	SCREEN *sp = _nc_screen_of(win);
 #endif
 	_nc_lock_global(curses);
-	if (win->_flags & _ISPAD) {
+	if (IS_PAD(win)) {
 	    nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx
 					    win->_maxy + 1,
 					    win->_maxx + 1);
@@ -200,6 +200,8 @@
 	}
 
 	if (nwin != 0) {
+	    int i;
+	    size_t linesize;
 
 	    nwin->_curx = win->_curx;
 	    nwin->_cury = win->_cury;
@@ -236,7 +238,7 @@
 	    nwin->_regtop = win->_regtop;
 	    nwin->_regbottom = win->_regbottom;
 
-	    if (win->_flags & _ISPAD)
+	    if (IS_PAD(win))
 		nwin->_pad = win->_pad;
 
 	    linesize = (unsigned) (win->_maxx + 1) * sizeof(NCURSES_CH_T);