]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
decompress: conditionally remove legacy members from context
authorNorbert Lange <nolange79@gmail.com>
Fri, 24 Sep 2021 23:19:11 +0000 (01:19 +0200)
committerNorbert Lange <nolange79@gmail.com>
Sun, 26 Sep 2021 10:12:17 +0000 (12:12 +0200)
Remove the then unneeded variables from the struct,
and all accesses to them.

lib/decompress/zstd_decompress.c
lib/decompress/zstd_decompress_internal.h

index 88a5ceebb1ad35cc337f9e2fe213211c8194e453..bcf36b91109b52134f722283857ef0c11f49ecc8 100644 (file)
@@ -255,8 +255,10 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx)
     dctx->inBuffSize  = 0;
     dctx->outBuffSize = 0;
     dctx->streamStage = zdss_init;
+#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
     dctx->legacyContext = NULL;
     dctx->previousLegacyVersion = 0;
+#endif
     dctx->noForwardProgress = 0;
     dctx->oversizedDuration = 0;
     dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid());
@@ -1947,7 +1949,9 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
             DEBUGLOG(5, "stage zdss_init => transparent reset ");
             zds->streamStage = zdss_loadHeader;
             zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0;
+#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
             zds->legacyVersion = 0;
+#endif
             zds->hostageByte = 0;
             zds->expectedOutBuffer = *output;
             ZSTD_FALLTHROUGH;
index ebda0c9031db6c13f484a6aaf527697c4b11752e..cb43539ad77694a948d89f3818913281c8e24b6d 100644 (file)
@@ -158,9 +158,11 @@ struct ZSTD_DCtx_s
     size_t outStart;
     size_t outEnd;
     size_t lhSize;
+#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
     void* legacyContext;
     U32 previousLegacyVersion;
     U32 legacyVersion;
+#endif
     U32 hostageByte;
     int noForwardProgress;
     ZSTD_bufferMode_e outBufferMode;