Skip to content

Commit a7d5961

Browse files
committed
refactor: zstd_uncompress_init() using php_zstd_context_create_decompress()
1 parent d655ae2 commit a7d5961

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

zstd.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -683,19 +683,10 @@ ZEND_FUNCTION(zstd_uncompress_init)
683683
{
684684
PHP_ZSTD_CONTEXT_OBJ_INIT_OF_CLASS(php_zstd_uncompress_context_ce);
685685

686-
ctx->dctx = ZSTD_createDCtx();
687-
if (ctx->dctx == NULL) {
686+
if (php_zstd_context_create_decompress(ctx, NULL) != SUCCESS) {
688687
zval_ptr_dtor(return_value);
689-
ZSTD_WARNING("failed to create uncompress context");
690688
RETURN_FALSE;
691689
}
692-
ctx->cdict = NULL;
693-
694-
ZSTD_DCtx_reset(ctx->dctx, ZSTD_reset_session_only);
695-
696-
ctx->output.size = ZSTD_DStreamOutSize();
697-
ctx->output.dst = emalloc(ctx->output.size);
698-
ctx->output.pos = 0;
699690
}
700691

701692
ZEND_FUNCTION(zstd_uncompress_add)

0 commit comments

Comments
 (0)