Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
18a05fd
)
Simplify tdeftrans
author
Roberto E. Vargas Caballero <
[email protected]
>
Sat, 7 Jun 2014 11:23:45 +0000
(13:23 +0200)
committer
Roberto E. Vargas Caballero <
[email protected]
>
Sat, 7 Jun 2014 11:23:45 +0000
(13:23 +0200)
st.c
patch
|
blob
|
history
diff --git
a/st.c
b/st.c
index
fde4d2d
..
b148401
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-2315,19
+2315,14
@@
techo(char *buf, int len) {
void
tdeftran(char ascii) {
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 */;
+ static char cs[] = "0B";
+ static int vcs[] = {CS_GRAPHIC0, CS_USA};
+ char *p;
- if
(c == 0
)
+ if
((p = strchr(cs, ascii)) == NULL
)
fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
else
fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
else
- term.trantbl[term.icharset] =
(*bp)[1
];
+ term.trantbl[term.icharset] =
vcs[p - cs
];
}
void
}
void