[dev] [PATCH v2][st] Refactor the innermost loop of the xdraws function

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Fri, 6 Jun 2014 22:09:22 +0200

Signed-off-by: Silvan Jegen <s.jegen_AT_gmail.com>
---
 st.c | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/st.c b/st.c
index fde4d2d..80b7a70 100644
--- a/st.c
+++ b/st.c
_AT_@ -3249,28 +3249,22 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
 			bytelen -= u8cblen;
 
 			doesexist = XftCharExists(xw.dpy, font->match, unicodep);
-			if(oneatatime || !doesexist || bytelen <= 0) {
-				if(oneatatime || bytelen <= 0) {
-					if(doesexist) {
-						u8fl++;
-						u8fblen += u8cblen;
-					}
-				}
-
-				if(u8fl > 0) {
-					XftDrawStringUtf8(xw.draw, fg,
-							font->match, xp,
-							winy + font->ascent,
-							(FcChar8 *)u8fs,
-							u8fblen);
-					xp += xw.cw * u8fl;
-
-				}
-				break;
+			if(doesexist) {
+					u8fl++;
+					u8fblen += u8cblen;
+					if(!oneatatime && bytelen > 0)
+							continue;
 			}
 
-			u8fl++;
-			u8fblen += u8cblen;
+			if(u8fl > 0) {
+				XftDrawStringUtf8(xw.draw, fg,
+						font->match, xp,
+						winy + font->ascent,
+						(FcChar8 *)u8fs,
+						u8fblen);
+				xp += xw.cw * u8fl;
+			}
+			break;
 		}
 		if(doesexist) {
 			if(oneatatime)
-- 
2.0.0
Received on Fri Jun 06 2014 - 22:09:22 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 06 2014 - 22:12:06 CEST