[dev] [st patch queue 02/12] Use BETWEEN macro in xsetcolorname and fix style.

From: noname <noname_AT_inventati.org>
Date: Fri, 25 Apr 2014 18:24:54 +0400

---
 st.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/st.c b/st.c
index 816caf7..35bbe9c 100644
--- a/st.c
+++ b/st.c
_AT_@ -2746,10 +2746,10 @@ int
 xsetcolorname(int x, const char *name) {
 	XRenderColor color = { .alpha = 0xffff };
 	Colour colour;
-	if (x < 0 || x > LEN(colorname))
+	if(!BETWEEN(x, 0, LEN(colorname)))
 		return -1;
 	if(!name) {
-		if(16 <= x && x < 16 + 216) {
+		if(BETWEEN(x, 16, 16 + 215)) {
 			int r = (x - 16) / 36, g = ((x - 16) % 36) / 6, b = (x - 16) % 6;
 			color.red = sixd_to_16bit(r);
 			color.green = sixd_to_16bit(g);
_AT_@ -2758,7 +2758,7 @@ xsetcolorname(int x, const char *name) {
 				return 0; /* something went wrong */
 			dc.col[x] = colour;
 			return 1;
-		} else if (16 + 216 <= x && x < 256) {
+		} else if(BETWEEN(x, 16 + 216, 255)) {
 			color.red = color.green = color.blue = 0x0808 + 0x0a0a * (x - (16 + 216));
 			if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &colour))
 				return 0; /* something went wrong */
-- 
1.8.4
Received on Fri Apr 25 2014 - 16:24:54 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 25 2014 - 16:36:10 CEST