]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Remove 'opaque' naming from internal functions
authorStella Lau <laus@fb.com>
Tue, 22 Aug 2017 21:24:47 +0000 (14:24 -0700)
committerStella Lau <laus@fb.com>
Tue, 22 Aug 2017 21:24:47 +0000 (14:24 -0700)
lib/common/zstd_internal.h
lib/compress/zstd_compress.c
lib/compress/zstdmt_compress.c

index 4e56f6a92195a0bcbb89f073d1220776ff4cdbfd..a68c7cbce23bec56282177914fdcc91541e809b7 100644 (file)
@@ -372,17 +372,17 @@ size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs,
 ZSTD_CCtx_params ZSTD_getCCtxParamsFromCDict(const ZSTD_CDict* cdict);
 
 /* INTERNAL */
-size_t ZSTD_compressBegin_advanced_opaque(ZSTD_CCtx* cctx,
+size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
                                     const void* dict, size_t dictSize,
                                     ZSTD_CCtx_params params,
                                     unsigned long long pledgedSrcSize);
 
 /* INTERNAL */
-size_t ZSTD_compress_advanced_opaque(ZSTD_CCtx* cctx,
-                                     void* dst, size_t dstCapacity,
-                               const void* src, size_t srcSize,
-                               const void* dict,size_t dictSize,
-                               ZSTD_CCtx_params params);
+size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx,
+                                       void* dst, size_t dstCapacity,
+                                 const void* src, size_t srcSize,
+                                 const void* dict,size_t dictSize,
+                                 ZSTD_CCtx_params params);
 
 typedef struct {
     blockType_e blockType;
index cfefe5c20584cdfa88693bf3939ea4a5c3622408..65081b239c3c82ef2243b08af647fbd09e609b3b 100644 (file)
@@ -3418,7 +3418,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
     return ZSTD_compress_insertDictionary(cctx, dict, dictSize, params.dictMode);
 }
 
-size_t ZSTD_compressBegin_advanced_opaque(
+size_t ZSTD_compressBegin_advanced_internal(
                                     ZSTD_CCtx* cctx,
                                     const void* dict, size_t dictSize,
                                     ZSTD_CCtx_params params,
@@ -3443,8 +3443,8 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx,
     cctxParams.fParams = params.fParams;
     cctxParams.dictMode = ZSTD_dm_auto;
 
-    return ZSTD_compressBegin_advanced_opaque(cctx, dict, dictSize, cctxParams,
-                                              pledgedSrcSize);
+    return ZSTD_compressBegin_advanced_internal(cctx, dict, dictSize, cctxParams,
+                                                pledgedSrcSize);
 }
 
 
@@ -3535,11 +3535,11 @@ static size_t ZSTD_compress_internal (ZSTD_CCtx* cctx,
     cctxParams.cParams = params.cParams;
     cctxParams.fParams = params.fParams;
     cctxParams.dictMode = ZSTD_dm_auto;
-    return ZSTD_compress_advanced_opaque(cctx,
-                                         dst, dstCapacity,
-                                         src, srcSize,
-                                         dict, dictSize,
-                                         cctxParams);
+    return ZSTD_compress_advanced_internal(cctx,
+                                          dst, dstCapacity,
+                                          src, srcSize,
+                                          dict, dictSize,
+                                          cctxParams);
 }
 
 size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx,
@@ -3553,7 +3553,7 @@ size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx,
 }
 
 /* Internal */
-size_t ZSTD_compress_advanced_opaque(
+size_t ZSTD_compress_advanced_internal(
         ZSTD_CCtx* cctx,
         void* dst, size_t dstCapacity,
         const void* src, size_t srcSize,
@@ -3888,7 +3888,7 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize)
 }
 
 /*! ZSTD_initCStream_internal() :
- *  Note : not static (but hidden) (not exposed). Used by zstdmt_compress.c
+ *  Note : not static, but hidden (not exposed). Used by zstdmt_compress.c
  *  Assumption 1 : params are valid
  *  Assumption 2 : either dict, or cdict, is defined, not both */
 size_t ZSTD_initCStream_internal(
@@ -4154,12 +4154,12 @@ size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuf
     return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue);
 }
 
-/*! ZSTDMT_initCStream_internal_opaque() :
+/*! ZSTDMT_initCStream_internal() :
  *  Private use only. Init streaming operation.
  *  expects params to be valid.
  *  must receive dict, or cdict, or none, but not both.
  *  @return : 0, or an error code */
-size_t ZSTDMT_initCStream_internal_opaque(ZSTDMT_CCtx* zcs,
+size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
                     const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
                     ZSTD_CCtx_params params, unsigned long long pledgedSrcSize);
 
@@ -4188,7 +4188,7 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
 #ifdef ZSTD_MULTITHREAD
         if (params.nbThreads > 1) {
             DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads);
-            CHECK_F( ZSTDMT_initCStream_internal_opaque(cctx->mtctx, prefix, prefixSize, cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
+            CHECK_F( ZSTDMT_initCStream_internal(cctx->mtctx, prefix, prefixSize, cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
             cctx->streamStage = zcss_load;
         } else
 #endif
index ebedec90405bc9737d38d47de120c4a56e4dfcc3..4b8360933d8bb704844d9d5436377e977ddd777d 100644 (file)
@@ -342,7 +342,7 @@ void ZSTDMT_compressChunk(void* jobDescription)
     } else {  /* srcStart points at reloaded section */
         if (!job->firstChunk) job->params.fParams.contentSizeFlag = 0;  /* ensure no srcSize control */
         {   size_t const dictModeError = ZSTD_setCCtxParameter(cctx, ZSTD_p_forceRawDict, 1);  /* Force loading dictionary in "content-only" mode (no header analysis) */
-            size_t const initError = ZSTD_compressBegin_advanced_opaque(cctx, job->srcStart, job->dictSize, job->params, job->fullFrameSize);
+            size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, job->srcStart, job->dictSize, job->params, job->fullFrameSize);
             if (ZSTD_isError(initError) || ZSTD_isError(dictModeError)) { job->cSize = initError; goto _endJob; }
             ZSTD_setCCtxParameter(cctx, ZSTD_p_forceWindow, 1);
     }   }
@@ -540,7 +540,7 @@ static unsigned computeNbChunks(size_t srcSize, unsigned windowLog, unsigned nbT
     return (multiplier>1) ? nbChunksLarge : nbChunksSmall;
 }
 
-static size_t ZSTDMT_compress_advanced_opaque(
+static size_t ZSTDMT_compress_advanced_internal(
                 ZSTDMT_CCtx* mtctx,
                 void* dst, size_t dstCapacity,
           const void* src, size_t srcSize,
@@ -564,7 +564,7 @@ static size_t ZSTDMT_compress_advanced_opaque(
     if (nbChunks==1) {   /* fallback to single-thread mode */
         ZSTD_CCtx* const cctx = mtctx->cctxPool->cctx[0];
         if (cdict) return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, cctxParams.fParams);
-        return ZSTD_compress_advanced_opaque(cctx, dst, dstCapacity, src, srcSize, NULL, 0, requestedParams);
+        return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, NULL, 0, requestedParams);
     }
     assert(avgChunkSize >= 256 KB);  /* condition for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B), which is required for compressWithinDst */
     ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(avgChunkSize) );
@@ -674,10 +674,10 @@ size_t ZSTDMT_compress_advanced(ZSTDMT_CCtx* mtctx,
     ZSTD_CCtx_params cctxParams = mtctx->params;
     cctxParams.cParams = params.cParams;
     cctxParams.fParams = params.fParams;
-    return ZSTDMT_compress_advanced_opaque(mtctx,
-                                           dst, dstCapacity,
-                                           src, srcSize,
-                                           cdict, cctxParams, overlapLog);
+    return ZSTDMT_compress_advanced_internal(mtctx,
+                                             dst, dstCapacity,
+                                             src, srcSize,
+                                             cdict, cctxParams, overlapLog);
 }
 
 
@@ -712,7 +712,7 @@ static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* zcs)
     }
 }
 
-size_t ZSTDMT_initCStream_internal_opaque(
+size_t ZSTDMT_initCStream_internal(
         ZSTDMT_CCtx* zcs, const void* dict, size_t dictSize,
         const ZSTD_CDict* cdict, ZSTD_CCtx_params cctxParams,
         unsigned long long pledgedSrcSize)
@@ -773,25 +773,17 @@ size_t ZSTDMT_initCStream_internal_opaque(
     return 0;
 }
 
-/** ZSTDMT_initCStream_internal() */
-static size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
-                    const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
-                    ZSTD_parameters params, unsigned long long pledgedSrcSize)
-{
-    ZSTD_CCtx_params cctxParams = zcs->params;
-    cctxParams.cParams = params.cParams;
-    cctxParams.fParams = params.fParams;
-    return ZSTDMT_initCStream_internal_opaque(zcs, dict, dictSize, cdict,
-                                              cctxParams, pledgedSrcSize);
-}
-
 size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx,
                              const void* dict, size_t dictSize,
                                    ZSTD_parameters params,
                                    unsigned long long pledgedSrcSize)
 {
+    ZSTD_CCtx_params cctxParams = mtctx->params;
     DEBUGLOG(5, "ZSTDMT_initCStream_advanced");
-    return ZSTDMT_initCStream_internal(mtctx, dict, dictSize, NULL, params, pledgedSrcSize);
+    cctxParams.cParams = params.cParams;
+    cctxParams.fParams = params.fParams;
+    return ZSTDMT_initCStream_internal(mtctx, dict, dictSize, NULL,
+                                       cctxParams, pledgedSrcSize);
 }
 
 size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
@@ -799,12 +791,11 @@ size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
                                      ZSTD_frameParameters fParams,
                                      unsigned long long pledgedSrcSize)
 {
-    ZSTD_CCtx_params requestedParams =
-            ZSTDMT_makeJobCCtxParams(ZSTD_getCCtxParamsFromCDict(cdict));
+    ZSTD_CCtx_params requestedParams = ZSTD_getCCtxParamsFromCDict(cdict);
     if (cdict==NULL) return ERROR(dictionary_wrong);   /* method incompatible with NULL cdict */
     requestedParams.fParams = fParams;
-    return ZSTDMT_initCStream_internal_opaque(mtctx, NULL, 0 /*dictSize*/, cdict,
-                                              requestedParams, pledgedSrcSize);
+    return ZSTDMT_initCStream_internal(mtctx, NULL, 0 /*dictSize*/, cdict,
+                                       requestedParams, pledgedSrcSize);
 }
 
 
@@ -814,13 +805,16 @@ size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* zcs, unsigned long long pledgedSrcSize)
 {
     if (zcs->nbThreads==1)
         return ZSTD_resetCStream(zcs->cctxPool->cctx[0], pledgedSrcSize);
-    return ZSTDMT_initCStream_internal_opaque(zcs, NULL, 0, 0, zcs->params,
-                                              pledgedSrcSize);
+    return ZSTDMT_initCStream_internal(zcs, NULL, 0, 0, zcs->params,
+                                       pledgedSrcSize);
 }
 
 size_t ZSTDMT_initCStream(ZSTDMT_CCtx* zcs, int compressionLevel) {
     ZSTD_parameters const params = ZSTD_getParams(compressionLevel, 0, 0);
-    return ZSTDMT_initCStream_internal(zcs, NULL, 0, NULL, params, 0);
+    ZSTD_CCtx_params cctxParams = zcs->params;
+    cctxParams.cParams = params.cParams;
+    cctxParams.fParams = params.fParams;
+    return ZSTDMT_initCStream_internal(zcs, NULL, 0, NULL, cctxParams, 0);
 }
 
 
@@ -973,7 +967,7 @@ size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
       && (mtctx->inBuff.filled==0)  /* nothing buffered */
       && (endOp==ZSTD_e_end)        /* end order */
       && (output->size - output->pos >= ZSTD_compressBound(input->size - input->pos)) ) { /* enough room */
-        size_t const cSize = ZSTDMT_compress_advanced_opaque(mtctx,
+        size_t const cSize = ZSTDMT_compress_advanced_internal(mtctx,
                 (char*)output->dst + output->pos, output->size - output->pos,
                 (const char*)input->src + input->pos, input->size - input->pos,
                 mtctx->cdict, mtctx->params, mtctx->overlapLog);