JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Removing two unnecessary gettimeofday().
[st.git] / st.c
diff --git a/st.c b/st.c
index e20a1e0..a104a50 100644 (file)
--- a/st.c
+++ b/st.c
@@ -1257,7 +1257,7 @@ ttyread(void) {
        /* process every complete utf8 char */
        buflen += ret;
        ptr = buf;
-       while(charsize = utf8decode(ptr, &unicodep, buflen)) {
+       while((charsize = utf8decode(ptr, &unicodep, buflen))) {
                utf8encode(unicodep, s, UTF_SIZ);
                tputc(s, charsize);
                ptr += charsize;
@@ -2263,9 +2263,10 @@ tdumpsel(void)
 {
        char *ptr;
 
-       ptr = getsel();
-       tprinter(ptr, strlen(ptr));
-       free(ptr);
+       if((ptr = getsel())) {
+               tprinter(ptr, strlen(ptr));
+               free(ptr);
+       }
 }
 
 void
@@ -3439,7 +3440,6 @@ void
 redraw(int timeout) {
        struct timespec tv = {0, timeout * 1000};
 
-       tfulldirt();
        draw();
 
        if(timeout > 0) {
@@ -3737,8 +3737,8 @@ run(void) {
        else
                cresize(xw.fw, xw.fh);
 
-       gettimeofday(&lastblink, NULL);
        gettimeofday(&last, NULL);
+       lastblink = last;
 
        for(xev = actionfps;;) {
                long deltatime;
@@ -3773,7 +3773,7 @@ run(void) {
                if(blinktimeout && TIMEDIFF(now, lastblink) > blinktimeout) {
                        tsetdirtattr(ATTR_BLINK);
                        term.mode ^= MODE_BLINK;
-                       gettimeofday(&lastblink, NULL);
+                       lastblink = now;
                        dodraw = 1;
                }
                deltatime = TIMEDIFF(now, last);