From 70ba2c463f65aa818f76f32f6bf585ebb53c0c30 Mon Sep 17 00:00:00 2001 From: "yann.collet.73@gmail.com" Date: Sat, 19 Nov 2011 21:38:27 +0000 Subject: Better compliance with C99 and non-C99 compilators git-svn-id: https://lz4.googlecode.com/svn/trunk@40 650e7d94-2a16-8b24-b05c-7c0b3f6821cd --- lz4.c | 12 ++++++++++-- lz4.h | 1 + lz4demo.c | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lz4.c b/lz4.c index 3a94f99..1cf04d8 100644 --- a/lz4.c +++ b/lz4.c @@ -28,6 +28,16 @@ */ //************************************** +// Compilation Directives +//************************************** +#if __STDC_VERSION__ >= 199901L + /* "restrict" is a known keyword */ +#else +#define restrict // Disable restrict +#endif + + +//************************************** // Includes //************************************** #include // for malloc @@ -53,14 +63,12 @@ #define U16 unsigned __int16 #define U32 unsigned __int32 #define S32 __int32 -#define restrict // Visual Studio does not support 'restrict' keyword either #else #include #define BYTE uint8_t #define U16 uint16_t #define U32 uint32_t #define S32 int32_t -#define restrict restrict #endif diff --git a/lz4.h b/lz4.h index c8c62f6..0251157 100644 --- a/lz4.h +++ b/lz4.h @@ -27,6 +27,7 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#pragma once #if defined (__cplusplus) extern "C" { diff --git a/lz4demo.c b/lz4demo.c index b876dc5..e349485 100644 --- a/lz4demo.c +++ b/lz4demo.c @@ -30,7 +30,7 @@ //**************************** // Includes //**************************** -#include // fprintf, fopen, fread +#include // fprintf, fopen, fread, _fileno(?) #include // malloc #include // strcmp #include // clock -- cgit v0.12