]> granicus.if.org Git - mutt/commitdiff
Change mutt_window_getyx() to accept NULL *y/*x params.
authorKevin McCarthy <kevin@8t8.us>
Tue, 3 May 2016 16:46:51 +0000 (09:46 -0700)
committerKevin McCarthy <kevin@8t8.us>
Tue, 3 May 2016 16:46:51 +0000 (09:46 -0700)
Thanks to Vincent Lefèvre for suggesting this nice cleanup.
Previously, _mutt_get_field() was employing an ugly hack to avoid an
unused var warning.

curs_lib.c

index 5623596624cb5c58f3128542d369d5f26ce971d5..f7c0bbd6084c400be7d31d97047b7b0d8960a00c 100644 (file)
@@ -165,7 +165,7 @@ int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete,
     addstr ((char *)field); /* cast to get around bad prototypes */
     NORMAL_COLOR;
     mutt_refresh ();
-    mutt_window_getyx (MuttMessageWindow, &ret, &x);  /* don't care about y: avoiding unused var warning */
+    mutt_window_getyx (MuttMessageWindow, NULL, &x);
     ret = _mutt_enter_string (buf, buflen, x, complete, multiple, files, numfiles, es);
   }
   while (ret == 1);
@@ -628,8 +628,10 @@ void mutt_window_getyx (mutt_window_t *win, int *y, int *x)
   int row, col;
 
   getyx (stdscr, row, col);
-  *y = row - win->row_offset;
-  *x = col - win->col_offset;
+  if (y)
+    *y = row - win->row_offset;
+  if (x)
+    *x = col - win->col_offset;
 }