From de6c548ec5adaed004e64a79611f2f1426570a56 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Wed, 12 Jul 2023 12:40:27 -0400 Subject: [PATCH] Redundant dereferences. --- pdcurses/touch.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pdcurses/touch.c b/pdcurses/touch.c index e1b7c60e..b431106e 100644 --- a/pdcurses/touch.c +++ b/pdcurses/touch.c @@ -168,25 +168,30 @@ bool is_wintouched(WINDOW *win) int touchoverlap(const WINDOW *win1, WINDOW *win2) { - int y, endy, endx, starty, startx; + int y, endy, endx, starty, startx, begy1, begx1, begy2, begx2; PDC_LOG(("touchoverlap() - called: win1=%p win2=%p\n", win1, win2)); if (!win1 || !win2) return ERR; - starty = max(win1->_begy, win2->_begy); - startx = max(win1->_begx, win2->_begx); - endy = min(win1->_maxy + win1->_begy, win2->_maxy + win2->_begy); - endx = min(win1->_maxx + win1->_begx, win2->_maxx + win2->_begx); + begy1 = win1->_begy; + begx1 = win1->_begx; + begy2 = win2->_begy; + begx2 = win2->_begy; + + starty = max(begy1, begy2); + startx = max(begx1, begx2); + endy = min(win1->_maxy + begy1, win2->_maxy + begy2); + endx = min(win1->_maxx + begx1, win2->_maxx + begx2); if (starty >= endy || startx >= endx) return OK; - starty -= win2->_begy; - startx -= win2->_begx; - endy -= win2->_begy; - endx -= win2->_begx; + starty -= begy2; + startx -= begx2; + endy -= begy2; + endx -= begx2; endx -= 1; for (y = starty; y < endy; y++)