static state size
authorYann Collet <cyan@fb.com>
Sat, 7 Nov 2020 02:26:13 +0000 (18:26 -0800)
committerYann Collet <cyan@fb.com>
Sat, 7 Nov 2020 02:26:13 +0000 (18:26 -0800)
for better inter-version compatibility

lib/lz4.h
lib/lz4hc.h

index 026279bd73cdb8558e61d0d6fbb951e11ddf8a8a..c4324afe189dec5a8d82a460e73119d4e9785fb7 100644 (file)
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -620,8 +620,8 @@ typedef struct {
  *  note : only use this definition in association with static linking !
  *  this definition is not API/ABI safe, and may change in future versions.
  */
-#define LZ4_STREAMSIZE_VOIDP ((sizeof(LZ4_stream_t_internal) + sizeof(void*)-1) / sizeof(void*))
-#define LZ4_STREAMSIZE       (LZ4_STREAMSIZE_VOIDP * sizeof(void*))
+#define LZ4_STREAMSIZE       16416  /* static size, for inter-version compatibility */
+#define LZ4_STREAMSIZE_VOIDP (LZ4_STREAMSIZE / sizeof(void*))
 union LZ4_stream_u {
     void* table[LZ4_STREAMSIZE_VOIDP];
     LZ4_stream_t_internal internal_donotuse;
index 228bb11c944001be4fcf2296206f654c241b24fe..3d441fb6fa96ec4bc1be204ff81ae2261d453b5b 100644 (file)
@@ -220,8 +220,8 @@ struct LZ4HC_CCtx_internal
 /* Do not use these definitions directly !
  * Declare or allocate an LZ4_streamHC_t instead.
  */
-#define LZ4_STREAMHCSIZE_VOIDP ((sizeof(LZ4HC_CCtx_internal) + sizeof(void*)-1) / sizeof(void*))
-#define LZ4_STREAMHCSIZE       (LZ4_STREAMHCSIZE_VOIDP * sizeof(void*))
+#define LZ4_STREAMHCSIZE       262200  /* static size, for inter-version compatibility */
+#define LZ4_STREAMHCSIZE_VOIDP (LZ4_STREAMHCSIZE / sizeof(void*))
 union LZ4_streamHC_u {
     void* table[LZ4_STREAMHCSIZE_VOIDP];
     LZ4HC_CCtx_internal internal_donotuse;