summaryrefslogtreecommitdiffstats
path: root/bench.c
diff options
context:
space:
mode:
Diffstat (limited to 'bench.c')
-rw-r--r--bench.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/bench.c b/bench.c
index f605249..07fd091 100644
--- a/bench.c
+++ b/bench.c
@@ -30,24 +30,18 @@
#define _CRT_SECURE_NO_DEPRECATE // VS2005
// Unix Large Files support (>4GB)
+#define _FILE_OFFSET_BITS 64
#if (defined(__sun__) && (!defined(__LP64__))) // Sun Solaris 32-bits requires specific definitions
# define _LARGEFILE_SOURCE
-# define _FILE_OFFSET_BITS 64
#elif ! defined(__LP64__) // No point defining Large file for 64 bit
# define _LARGEFILE64_SOURCE
#endif
// S_ISREG & gettimeofday() are not supported by MSVC
-#if defined(_MSC_VER)
-# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
+#if defined(_MSC_VER) || defined(_WIN32)
# define BMK_LEGACY_TIMER 1
#endif
-// GCC does not support _rotl outside of Windows
-#if !defined(_WIN32)
-# define _rotl(x,r) ((x << r) | (x >> (32 - r)))
-#endif
-
//**************************************
// Includes
@@ -74,6 +68,19 @@
//**************************************
+// Compiler specifics
+//**************************************
+#if !defined(S_ISREG)
+# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
+#endif
+
+// GCC does not support _rotl outside of Windows
+#if !defined(_WIN32)
+# define _rotl(x,r) ((x << r) | (x >> (32 - r)))
+#endif
+
+
+//**************************************
// Basic Types
//**************************************
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L // C99
@@ -153,6 +160,7 @@ void BMK_SetPause()
BMK_pause = 1;
}
+
//*********************************************************
// Private functions
//*********************************************************
@@ -300,11 +308,12 @@ int BMK_benchFile(char** fileNamesTable, int nbFiles, int cLevel)
compressed_buff = (char*)malloc((size_t )compressed_buff_size);
- if(!orig_buff || !compressed_buff)
+ if (!orig_buff || !compressed_buff)
{
DISPLAY("\nError: not enough memory!\n");
free(orig_buff);
free(compressed_buff);
+ free(chunkP);
fclose(fileIn);
return 12;
}
@@ -330,11 +339,12 @@ int BMK_benchFile(char** fileNamesTable, int nbFiles, int cLevel)
readSize = fread(orig_buff, 1, benchedSize, fileIn);
fclose(fileIn);
- if(readSize != benchedSize)
+ if (readSize != benchedSize)
{
DISPLAY("\nError: problem reading file '%s' !! \n", infilename);
free(orig_buff);
free(compressed_buff);
+ free(chunkP);
return 13;
}