diff options
author | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2011-11-19 21:38:27 (GMT) |
---|---|---|
committer | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2011-11-19 21:38:27 (GMT) |
commit | 70ba2c463f65aa818f76f32f6bf585ebb53c0c30 (patch) | |
tree | 7c6c86f33ee1fafd71f3c888a3029371a1145d22 | |
parent | 62c39e2445023183f34ae65faaa16a5b80ea8bda (diff) | |
download | lz4-70ba2c463f65aa818f76f32f6bf585ebb53c0c30.zip lz4-70ba2c463f65aa818f76f32f6bf585ebb53c0c30.tar.gz lz4-70ba2c463f65aa818f76f32f6bf585ebb53c0c30.tar.bz2 |
Better compliance with C99 and non-C99 compilators
git-svn-id: https://lz4.googlecode.com/svn/trunk@40 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
-rw-r--r-- | lz4.c | 12 | ||||
-rw-r--r-- | lz4.h | 1 | ||||
-rw-r--r-- | lz4demo.c | 2 |
3 files changed, 12 insertions, 3 deletions
@@ -28,6 +28,16 @@ */
//**************************************
+// Compilation Directives
+//**************************************
+#if __STDC_VERSION__ >= 199901L
+ /* "restrict" is a known keyword */
+#else
+#define restrict // Disable restrict
+#endif
+
+
+//**************************************
// Includes
//**************************************
#include <stdlib.h> // 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 <stdint.h>
#define BYTE uint8_t
#define U16 uint16_t
#define U32 uint32_t
#define S32 int32_t
-#define restrict restrict
#endif
@@ -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" {
@@ -30,7 +30,7 @@ //****************************
// Includes
//****************************
-#include <stdio.h> // fprintf, fopen, fread
+#include <stdio.h> // fprintf, fopen, fread, _fileno(?)
#include <stdlib.h> // malloc
#include <string.h> // strcmp
#include <time.h> // clock
|