Use 'restrict' on pointer arguments to all compress() and decompress() functions
authorEric Biggers <ebiggers3@gmail.com>
Sun, 16 Aug 2015 19:09:09 +0000 (14:09 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 18 Aug 2015 22:53:49 +0000 (17:53 -0500)
src/lzms_compress.c
src/lzx_compress.c
src/lzx_decompress.c
src/xpress_compress.c
src/xpress_decompress.c

index 385fa05..f438e91 100644 (file)
@@ -2166,8 +2166,8 @@ oom0:
 }
 
 static size_t
-lzms_compress(const void *in, size_t in_nbytes,
-             void *out, size_t out_nbytes_avail, void *_c)
+lzms_compress(const void *restrict in, size_t in_nbytes,
+             void *restrict out, size_t out_nbytes_avail, void *restrict _c)
 {
        struct lzms_compressor *c = _c;
        size_t result;
index 28a2656..3f3b836 100644 (file)
@@ -2120,8 +2120,8 @@ oom0:
 }
 
 static size_t
-lzx_compress(const void *in, size_t in_nbytes,
-            void *out, size_t out_nbytes_avail, void *_c)
+lzx_compress(const void *restrict in, size_t in_nbytes,
+            void *restrict out, size_t out_nbytes_avail, void *restrict _c)
 {
        struct lzx_compressor *c = _c;
        struct lzx_output_bitstream os;
index d9ab5c3..a8fbcd7 100644 (file)
@@ -521,9 +521,9 @@ lzx_decompress_block(int block_type, u8 * const out_begin,
 }
 
 static int
-lzx_decompress(const void *compressed_data, size_t compressed_size,
-              void *uncompressed_data, size_t uncompressed_size,
-              void *_dec)
+lzx_decompress(const void *restrict compressed_data, size_t compressed_size,
+              void *restrict uncompressed_data, size_t uncompressed_size,
+              void *restrict _dec)
 {
        struct lzx_decompressor *dec = _dec;
        struct input_bitstream istream;
index cf29df9..6750160 100644 (file)
@@ -1135,8 +1135,8 @@ oom0:
 }
 
 static size_t
-xpress_compress(const void *in, size_t in_nbytes,
-               void *out, size_t out_nbytes_avail, void *_c)
+xpress_compress(const void *restrict in, size_t in_nbytes,
+               void *restrict out, size_t out_nbytes_avail, void *restrict _c)
 {
        struct xpress_compressor *c = _c;
 
index 51e781a..ec5b183 100644 (file)
@@ -76,8 +76,9 @@
 #define XPRESS_TABLEBITS 12
 
 static int
-xpress_decompress(const void *compressed_data, size_t compressed_size,
-                 void *uncompressed_data, size_t uncompressed_size, void *_ctx)
+xpress_decompress(const void *restrict compressed_data, size_t compressed_size,
+                 void *restrict uncompressed_data, size_t uncompressed_size,
+                 void *restrict _ctx)
 {
        const u8 * const in_begin = compressed_data;
        u8 * const out_begin = uncompressed_data;