From: Max Kellermann Date: Mon, 2 Nov 2009 21:51:05 +0000 (+0100) Subject: screen_song: fill spaces with memset() X-Git-Tag: release-0.16~34 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=29c489845c5a110f30a74ba206f6139663119260;p=ncmpc.git screen_song: fill spaces with memset() Faster than a manual "for" loop. --- 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;