]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - gui.c
gui: Don't compute string length unnecessarily.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index a8a7fc9fb22c44aee4ec310467abba0fcade2e78..696ea1b233a5063488abb5bf0fafc6fae85ae9b4 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -403,7 +403,7 @@ static int draw_top_rbe(unsigned *lines)
        rbe = ringbuffer_get(bot_win_rb, fvr);
        if (!rbe)
                return -1;
        rbe = ringbuffer_get(bot_win_rb, fvr);
        if (!rbe)
                return -1;
-       len = strlen(rbe->msg);
+       len = rbe->len;
        if (*lines > bot.lines) {
                /* first rbe is only partially visible */
                offset = (*lines - bot.lines) * bot.cols;
        if (*lines > bot.lines) {
                /* first rbe is only partially visible */
                offset = (*lines - bot.lines) * bot.cols;
@@ -1162,7 +1162,7 @@ static void com_scroll_top(void)
                struct rb_entry *rbe = ringbuffer_get(bot_win_rb, i);
                if (!rbe)
                        break;
                struct rb_entry *rbe = ringbuffer_get(bot_win_rb, i);
                if (!rbe)
                        break;
-               lines += NUM_LINES(strlen(rbe->msg));
+               lines += NUM_LINES(rbe->len);
        }
        i++;
        if (lines > 0 && scroll_position != i) {
        }
        i++;
        if (lines > 0 && scroll_position != i) {
@@ -1193,7 +1193,7 @@ static void com_page_down(void)
                struct rb_entry *rbe = ringbuffer_get(bot_win_rb, i);
                if (!rbe)
                        break;
                struct rb_entry *rbe = ringbuffer_get(bot_win_rb, i);
                if (!rbe)
                        break;
-               lines += NUM_LINES(strlen(rbe->msg));
+               lines += NUM_LINES(rbe->len);
        }
        if (lines) {
                scroll_position = i;
        }
        if (lines) {
                scroll_position = i;