JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Avoid initialization of vt100_0 in each call to tsetchar
authorRoberto E. Vargas Caballero <k0ga@shike2.com>
Sun, 7 Oct 2012 09:06:08 +0000 (11:06 +0200)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Sun, 7 Oct 2012 09:06:08 +0000 (11:06 +0200)
If vt100_0 is a automatic variable then it is initializated in each call to
tsetchar, but if the variable is static it is initializated only in compile
time.
---
 st.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

st.c

diff --git a/st.c b/st.c
index 8c8efaf..33a1501 100644 (file)
--- a/st.c
+++ b/st.c
@@ -1183,7 +1183,7 @@ tmoveto(int x, int y) {
 
 void
 tsetchar(char *c) {
-       char *vt100_0[62] = { /* 0x41 - 0x7e */
+       static char *vt100_0[62] = { /* 0x41 - 0x7e */
                "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */
                0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
                0, 0, 0, 0, 0, 0, 0, 0, /* P - W */