[dev] [st PATCH] Simplify tdeftran.

From: noname <noname_AT_inventati.org>
Date: Thu, 1 May 2014 03:22:36 +0400

---
 st.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/st.c b/st.c
index d0c4595..3f248f3 100644
--- a/st.c
+++ b/st.c
_AT_@ -2305,19 +2305,17 @@ techo(char *buf, int len) {
 
 void
 tdeftran(char ascii) {
-	char c, (*bp)[2];
-	static char tbl[][2] = {
-		{'0', CS_GRAPHIC0}, {'B', CS_USA},
-		{0, 0}
-	};
-
-	for (bp = &tbl[0]; (c = (*bp)[0]) && c != ascii; ++bp)
-		/* nothing */;
-
-	if (c == 0)
+	switch(ascii) {
+	case '0':
+		term.trantbl[term.icharset] = CS_GRAPHIC0;
+		break;
+	case 'B':
+		term.trantbl[term.icharset] = CS_USA;
+		break;
+	default:
 		fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
-	else
-		term.trantbl[term.icharset] = (*bp)[1];
+		break;
+	}
 }
 
 void
-- 
1.8.4
Received on Thu May 01 2014 - 01:22:36 CEST

This archive was generated by hypermail 2.3.0 : Thu May 01 2014 - 01:24:05 CEST