SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset()
authorOzkan Sezer <sezeroz@gmail.com>
Thu, 27 Sep 2018 01:00:50 +0300
changeset 122332d31c1a48111
parent 12232 d3b8ea488be8
child 12234 21c060522258
SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset()
src/stdlib/SDL_string.c
     1.1 --- a/src/stdlib/SDL_string.c	Thu Sep 27 00:32:15 2018 +0300
     1.2 +++ b/src/stdlib/SDL_string.c	Thu Sep 27 01:00:50 2018 +0300
     1.3 @@ -1416,7 +1416,7 @@
     1.4  static void
     1.5  SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
     1.6  {/* left-pad num with zeroes, if needed. */
     1.7 -    size_t sz, pad, i;
     1.8 +    size_t sz, pad;
     1.9  
    1.10      if (!info || info->precision < 0)
    1.11          return;
    1.12 @@ -1428,9 +1428,7 @@
    1.13          pad = (size_t)info->precision - sz;
    1.14          if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */
    1.15              SDL_memmove(num + pad, num, sz + 1);
    1.16 -            for(i = 0; i < pad; ++i) {
    1.17 -                num[i] = '0';
    1.18 -            }
    1.19 +            SDL_memset(num, '0', pad);
    1.20          }
    1.21      }
    1.22      info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */