From 5342ae2bba2957793db2eea716746f9df4681d8e Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 27 Sep 2018 01:00:50 +0300 Subject: [PATCH] SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset() --- src/stdlib/SDL_string.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 5ca6526ff..4ef742d9d 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -1416,7 +1416,7 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str static void SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info) {/* left-pad num with zeroes, if needed. */ - size_t sz, pad, i; + size_t sz, pad; if (!info || info->precision < 0) return; @@ -1428,9 +1428,7 @@ SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info) pad = (size_t)info->precision - sz; if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */ SDL_memmove(num + pad, num, sz + 1); - for(i = 0; i < pad; ++i) { - num[i] = '0'; - } + SDL_memset(num, '0', pad); } } info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */