]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed shadowing of variable time
authorYann Collet <cyan@fb.com>
Thu, 20 Dec 2018 22:54:05 +0000 (14:54 -0800)
committerYann Collet <cyan@fb.com>
Thu, 20 Dec 2018 22:54:05 +0000 (14:54 -0800)
some standard lib do define `time` as a global variable
shadowing local declarations ...

tests/paramgrill.c

index 7c52a92e42720d5e8cee8030aecb37f2491456e6..9f8c894eb736e9b90eca50ee276781fa85b376cf 100644 (file)
@@ -12,7 +12,7 @@
 /*-************************************
 *  Dependencies
 **************************************/
-#include "util.h"      /* Compiler options, UTIL_GetFileSize */
+#include "util.h"      /* Ensure platform.h is compiled first; also : compiler options, UTIL_GetFileSize */
 #include <stdlib.h>    /* malloc */
 #include <stdio.h>     /* fprintf, fopen, ftello64 */
 #include <string.h>    /* strcmp */
@@ -24,7 +24,6 @@
 #include "zstd.h"
 #include "datagen.h"
 #include "xxhash.h"
-#include "util.h"
 #include "benchfn.h"
 #include "benchzstd.h"
 #include "zstd_errors.h"
@@ -879,12 +878,12 @@ BMK_printWinner(FILE* f, const int cLevel, const BMK_benchResult_t result, const
 
     if(TIMED) {
         const U64 mn_in_ns = 60ULL * TIMELOOP_NANOSEC;
-        const U64 time = UTIL_clockSpanNano(g_time);
-        const U64 minutes = time / mn_in_ns;
+        const U64 time_ns = UTIL_clockSpanNano(g_time);
+        const U64 minutes = time_ns / mn_in_ns;
         fprintf(f, "%1lu:%2lu:%05.2f - ",
                 (unsigned long) minutes / 60,
                 (unsigned long) minutes % 60,
-                (double)(time - (minutes * mn_in_ns)) / TIMELOOP_NANOSEC );
+                (double)(time_ns - (minutes * mn_in_ns)) / TIMELOOP_NANOSEC );
     }
 
     fprintf(f, "/* %s */   ", lvlstr);