Skip to content

Commit bfca581

Browse files
committed
refactor: zstd_uncompress_add() to use zend_string for input parameter
1 parent a7d5961 commit bfca581

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

zstd.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,7 @@ ZEND_FUNCTION(zstd_uncompress_add)
693693
{
694694
zend_object *context;
695695
php_zstd_context *ctx;
696-
char *in_buf;
697-
size_t in_size;
696+
zend_string *input;
698697
smart_string out = {0};
699698
#if PHP_VERSION_ID >= 80000
700699
zend_object *obj;
@@ -708,7 +707,7 @@ ZEND_FUNCTION(zstd_uncompress_add)
708707
#else
709708
Z_PARAM_OBJECT_OF_CLASS(obj, php_zstd_uncompress_context_ce)
710709
#endif
711-
Z_PARAM_STRING(in_buf, in_size)
710+
Z_PARAM_STR(input)
712711
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
713712

714713
#if PHP_VERSION_ID >= 80000
@@ -721,7 +720,7 @@ ZEND_FUNCTION(zstd_uncompress_add)
721720
RETURN_FALSE;
722721
}
723722

724-
ZSTD_inBuffer in = { in_buf, in_size, 0 };
723+
ZSTD_inBuffer in = { ZSTR_VAL(input), ZSTR_LEN(input), 0 };
725724
size_t res = 1;
726725
const size_t grow = ZSTD_DStreamOutSize();
727726

0 commit comments

Comments
 (0)