From d365232a8510f82d38f743c703e6b5a058e1b164 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sat, 4 Jan 2014 16:05:42 +0100 Subject: [PATCH] optimized gwinGetVisible() and gwinGetEnabled() --- src/gwin/gwin.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 6d47f3b5..a2837d3b 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -222,11 +222,10 @@ bool_t gwinGetVisible(GHandle gh) { #if GWIN_NEED_HIERARCHY // return TRUE if all widgets (itself + parents) are visble, false otherwise GHandle e = gh; - while (e) { + for(e = gh; e; e = e->parent) { if (!(e->flags & GWIN_FLG_VISIBLE)) return FALSE; - e = e->parent; - }; + } return TRUE; #else return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE; @@ -251,11 +250,10 @@ bool_t gwinGetEnabled(GHandle gh) { #if GWIN_NEED_HIERARCHY // return TRUE if all widgets (itself + parents) are enabled, false otherwise GHandle e = gh; - while (e) { + for(e = gh; e; e = e->parent) { if (!(e->flags & GWIN_FLG_ENABLED)) return FALSE; - e = e->parent; - }; + } return TRUE; #else return (gh->flags & GWIN_FLG_ENABLED) ? TRUE : FALSE;