Instead of using #if HAVE_CURSES_WRESIZE at each call site, we can
make a simple wrapper function that "works" in either case.
+/* Thin wrapper around wresize which returns ERR if support is unavailable. */
+static int do_wresize(WINDOW *window, int lines, int columns)
+{
+#if HAVE_CURSES_WRESIZE
+ return wresize(window, lines, columns);
+#endif
+ return ERR;
+}
+
static WINDOW *realloc_area(WINDOW **orig, int h, int w, int y, int x)
{
WINDOW *win = *orig;
if (win) {
static WINDOW *realloc_area(WINDOW **orig, int h, int w, int y, int x)
{
WINDOW *win = *orig;
if (win) {
-#if HAVE_CURSES_WRESIZE
- if (wresize(win, h, w) != ERR) {
+ if (do_wresize(win, h, w) != ERR) {
mvwin(win, y, x);
return win;
}
mvwin(win, y, x);
return win;
}
if (fill && border) {
int old_w, old_h;
if (fill && border) {
int old_w, old_h;
-#if HAVE_CURSES_WRESIZE
- if (wresize(fill, h-2, w-2) != ERR
- && wresize(border, h, w) != ERR)
- {
+ if (do_wresize(fill, h-2, w-2) != ERR
+ && do_wresize(border, h, w) != ERR)
getmaxyx(border, old_h, old_w);
if (old_h == h)
getmaxyx(border, old_h, old_w);
if (old_h == h)