From d807043b4b2fd18a7ea6af362787d2e6130472a4 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Mon, 25 Oct 2021 17:19:16 +0000 Subject: tbi/win: add macro to validate (x, y) in a window --- lib/tbi/win.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/tbi/win.c b/lib/tbi/win.c index e3ba31e..bf674a2 100644 --- a/lib/tbi/win.c +++ b/lib/tbi/win.c @@ -7,6 +7,10 @@ #include "screen.h" #include "win.h" +#define CHECK_POSITION(win, x, y) \ + if(x < 0 || y < 0 || x >= w->width || y >= w->height) \ + return FALSE + struct window *newwin(struct screen *s, INT32 ncols, INT32 nlines, INT32 begin_x, INT32 begin_y) { -- cgit v1.2.3-18-g5258