[Commits] SDL: SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generatin...

libsdl.org revision control commits-owner at libsdl.org
Wed Sep 26 15:01:17 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/2d31c1a48111
changeset: 12233:2d31c1a48111
user:      Ozkan Sezer <sezeroz at gmail.com>
date:      Thu Sep 27 01:00:50 2018 +0300
description:
SDL_string.c (SDL_IntPrecisionAdjust): avoid MSVC generating a memset()

diffstat:

 src/stdlib/SDL_string.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r d3b8ea488be8 -r 2d31c1a48111 src/stdlib/SDL_string.c
--- a/src/stdlib/SDL_string.c	Thu Sep 27 00:32:15 2018 +0300
+++ b/src/stdlib/SDL_string.c	Thu Sep 27 01:00:50 2018 +0300
@@ -1416,7 +1416,7 @@
 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 @@
         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. */


More information about the commits mailing list