[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 3/4] Remove some unused constructs from zstd library
From:       Norbert Lange <nolange79 () gmail ! com>
Date:       2021-09-09 21:21:45
Message-ID: 20210909212146.23606-3-nolange79 () gmail ! com
[Download RAW message or body]

Remove cpuid instructions if DYNAMIC_BMI2 is not used, this
should allow constant propagation.

Completely remove Reference to error table.

Disable static DCtx allocation.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 archival/libarchive/zstd/common/error_private.h       | 5 +++++
 archival/libarchive/zstd/decompress/zstd_decompress.c | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/archival/libarchive/zstd/common/error_private.h \
b/archival/libarchive/zstd/common/error_private.h index f338521a9..566a4cf9b 100644
--- a/archival/libarchive/zstd/common/error_private.h
+++ b/archival/libarchive/zstd/common/error_private.h
@@ -67,7 +67,12 @@ ERR_STATIC const char* ERR_getErrorString(ERR_enum code);   /* \
error_private.c *  
 ERR_STATIC const char* ERR_getErrorName(size_t code)
 {
+#ifdef ZSTD_STRIP_ERROR_STRINGS
+    (void)code;
+    return "Error strings stripped";
+#else
     return ERR_getErrorString(ERR_getErrorCode(code));
+#endif
 }
 
 
diff --git a/archival/libarchive/zstd/decompress/zstd_decompress.c \
b/archival/libarchive/zstd/decompress/zstd_decompress.c index 829ee5e4d..912046f74 \
                100644
--- a/archival/libarchive/zstd/decompress/zstd_decompress.c
+++ b/archival/libarchive/zstd/decompress/zstd_decompress.c
@@ -253,7 +253,10 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx)
     dctx->previousLegacyVersion = 0;
     dctx->noForwardProgress = 0;
     dctx->oversizedDuration = 0;
+    dctx->bmi2 = 0;
+#if DYNAMIC_BMI2
     dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid());
+#endif
     dctx->ddictSet = NULL;
     ZSTD_DCtx_resetParameters(dctx);
 }
@@ -1962,7 +1965,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* \
                output, ZSTD_inB
                                     (U32)zds->inBuffSize, (U32)neededInBuffSize);
                         DEBUGLOG(4, "outBuff : from %u to %u",
                                     (U32)zds->outBuffSize, (U32)neededOutBuffSize);
-                        if (zds->staticSize) {  /* static DCtx */
+                        if (zds->staticSize && 0) {  /* static DCtx */
                             DEBUGLOG(4, "staticSize : %u", (U32)zds->staticSize);
                             assert(zds->staticSize >= sizeof(ZSTD_DCtx));  /* \
controlled at init */  RETURN_ERROR_IF(
-- 
2.33.0

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic