[hackers] [dwm][PATCH] remove NULL guards for XFree

From: Devin J. Pohly <djpohly_AT_gmail.com>
Date: Sun, 26 Jan 2020 18:13:51 -0600

XFree has always been an alias for free(), which does nothing when
passed NULL. (This behavior is now officially documented in the xorg
man page for XFree.)
---
 dwm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..dc77311 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -304,10 +304,8 @@ applyrules(Client *c)
 				c->mon = m;
 		}
 	}
-	if (ch.res_class)
-		XFree(ch.res_class);
-	if (ch.res_name)
-		XFree(ch.res_name);
+	XFree(ch.res_class);
+	XFree(ch.res_name);
 	c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
 }
 
_AT_@ -1402,8 +1400,7 @@ scan(void)
 			&& (wa.map_state == IsViewable || getstate(wins[i]) == IconicState))
 				manage(wins[i], &wa);
 		}
-		if (wins)
-			XFree(wins);
+		XFree(wins);
 	}
 }
 
-- 
2.25.0
Received on Mon Jan 27 2020 - 01:13:51 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 27 2020 - 01:24:26 CET