summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wiederhake <twied@gmx.net>2024-01-20 16:07:00 +0100
committerTim Wiederhake <twied@gmx.net>2024-01-20 16:07:00 +0100
commit24bfa418612288c4847bcfe088aba05ce402d1d2 (patch)
tree43b5ecccad466c77cc17bfedcca17c8ab0b965dd
parent9ad7b060e055f08ff39ee569f1cf40c7ac56e321 (diff)
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 <twied@gmx.net>
-rw-r--r--src/parse.c16
1 files 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;
}