From 29c489845c5a110f30a74ba206f6139663119260 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 2 Nov 2009 22:51:05 +0100 Subject: [PATCH] screen_song: fill spaces with memset() Faster than a manual "for" loop. --- src/screen_song.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/screen_song.c b/src/screen_song.c index 750beeb..5f652f5 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -158,14 +158,14 @@ screen_song_append(const char *label, const char *value, unsigned label_col) if (i == 0) { entry_iter = entry + g_sprintf(entry, "%s: ", label); /* fill the label column with whitespaces */ - for ( ; entry_iter < entry + label_size; ++entry_iter) - *entry_iter = ' '; + memset(entry_iter, ' ', + entry + label_size - entry_iter); + entry_iter = entry + label_size; } else { - entry_iter = entry; /* fill the label column with whitespaces */ - for ( ; entry_iter < entry + label_col; ++entry_iter) - *entry_iter = ' '; + memset(entry, ' ', label_col); + entry_iter = entry + label_col; } /* skip whitespaces */ while (g_ascii_isspace(*value_iter)) ++value_iter; -- 2.30.2