From 24bfa418612288c4847bcfe088aba05ce402d1d2 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Sat, 20 Jan 2024 16:07:00 +0100 Subject: Rework dummy variable usage in do_string_keyword twm defines several "junk" variables to use with functions like XQueryPointer or XGetGeometry. In some instances, the returned values are actually used, which makes the code confusing and hard to reason about. Use dedicated variables in those cases. Signed-off-by: Tim Wiederhake --- src/parse.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/parse.c b/src/parse.c index 48430b3..3a93806 100644 --- a/src/parse.c +++ b/src/parse.c @@ -747,6 +747,10 @@ do_single_keyword(int keyword) int do_string_keyword(int keyword, char *s) { + unsigned width = 0; + unsigned height = 0; + unsigned mask = 0; + switch (keyword) { case kws_UsePPosition: { @@ -797,20 +801,18 @@ do_string_keyword(int keyword, char *s) return 1; case kws_MaxWindowSize: - JunkMask = - (unsigned) XParseGeometry(s, &JunkX, &JunkY, &JunkWidth, - &JunkHeight); - if ((JunkMask & (WidthValue | HeightValue)) != + mask = (unsigned) XParseGeometry(s, &JunkX, &JunkY, &width, &height); + if ((mask & (WidthValue | HeightValue)) != (WidthValue | HeightValue)) { parseWarning("bad MaxWindowSize \"%s\"", s); return 0; } - if (JunkWidth <= 0 || JunkHeight <= 0) { + if (width <= 0 || height <= 0) { parseWarning("MaxWindowSize \"%s\" must be positive", s); return 0; } - Scr->MaxWindowWidth = (int) JunkWidth; - Scr->MaxWindowHeight = (int) JunkHeight; + Scr->MaxWindowWidth = (int) width; + Scr->MaxWindowHeight = (int) height; return 1; } -- cgit v1.2.3