Skip to content

Commit d655ae2

Browse files
committed
refactor: zstd_compress_add() to use zend_string for input parameter
1 parent f9f707c commit d655ae2

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
@@ -630,8 +630,7 @@ ZEND_FUNCTION(zstd_compress_init)
630630
ZEND_FUNCTION(zstd_compress_add)
631631
{
632632
php_zstd_context *ctx;
633-
char *in_buf;
634-
size_t in_size;
633+
zend_string *input;
635634
zend_bool end = 0;
636635
smart_string out = {0};
637636
#if PHP_VERSION_ID >= 80000
@@ -646,7 +645,7 @@ ZEND_FUNCTION(zstd_compress_add)
646645
#else
647646
Z_PARAM_OBJECT_OF_CLASS(obj, php_zstd_compress_context_ce)
648647
#endif
649-
Z_PARAM_STRING(in_buf, in_size)
648+
Z_PARAM_STR(input)
650649
Z_PARAM_OPTIONAL
651650
Z_PARAM_BOOL(end)
652651
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
@@ -661,7 +660,7 @@ ZEND_FUNCTION(zstd_compress_add)
661660
RETURN_FALSE;
662661
}
663662

664-
ZSTD_inBuffer in = { in_buf, in_size, 0 };
663+
ZSTD_inBuffer in = { ZSTR_VAL(input), ZSTR_LEN(input), 0 };
665664
size_t res;
666665

667666
do {

0 commit comments

Comments
 (0)