changed POOL_resize() return type to int

return is now just en error code.
This guarantee that `ctx` remains valid after POOL_resize().
Gets rid of internal POOL_free() operation.
This commit is contained in:
Yann Collet
2018-06-22 12:14:59 -07:00
parent 243cd9d8bb
commit fbd5dfc1b1
4 changed files with 29 additions and 37 deletions
+1 -2
View File
@@ -1018,8 +1018,7 @@ static ZSTD_CCtx_params ZSTDMT_initJobCCtxParams(ZSTD_CCtx_params const params)
* @return : error code if fails, 0 on success */
static size_t ZSTDMT_resize(ZSTDMT_CCtx* mtctx, unsigned nbWorkers)
{
mtctx->factory = POOL_resize(mtctx->factory, nbWorkers);
if (mtctx->factory == NULL) return ERROR(memory_allocation);
if (POOL_resize(mtctx->factory, nbWorkers)) return ERROR(memory_allocation);
CHECK_F( ZSTDMT_expandJobsTable(mtctx, nbWorkers) );
mtctx->bufPool = ZSTDMT_expandBufferPool(mtctx->bufPool, nbWorkers);
if (mtctx->bufPool == NULL) return ERROR(memory_allocation);