Skip to content

Commit e053740

Browse files
committed
ext/hash: Use new php_streams_context fast ZPP specifier
1 parent 45b6099 commit e053740

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ext/hash/hash.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -746,21 +746,23 @@ PHP_FUNCTION(hash_update_stream)
746746
/* {{{ Pump data into the hashing algorithm from a file */
747747
PHP_FUNCTION(hash_update_file)
748748
{
749-
zval *zhash, *zcontext = NULL;
749+
zend_object *hash_obj;
750750
php_hashcontext_object *hash;
751751
php_stream_context *context = NULL;
752752
php_stream *stream;
753753
zend_string *filename;
754754
char buf[1024];
755755
ssize_t n;
756756

757-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OP|r!", &zhash, php_hashcontext_ce, &filename, &zcontext) == FAILURE) {
758-
RETURN_THROWS();
759-
}
757+
ZEND_PARSE_PARAMETERS_START(2, 3)
758+
Z_PARAM_OBJ_OF_CLASS(hash_obj, php_hashcontext_ce)
759+
Z_PARAM_PATH_STR(filename)
760+
Z_PARAM_OPTIONAL
761+
PHP_Z_PARAM_STREAM_CONTEXT_OR_NULL_AS_DEFAULT_CONTEXT(context)
762+
ZEND_PARSE_PARAMETERS_END();
760763

761-
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
764+
hash = php_hashcontext_from_object(hash_obj);
762765
PHP_HASHCONTEXT_VERIFY(hash);
763-
context = php_stream_context_from_zval(zcontext, 0);
764766

765767
stream = php_stream_open_wrapper_ex(ZSTR_VAL(filename), "rb", REPORT_ERRORS, NULL, context);
766768
if (!stream) {

0 commit comments

Comments
 (0)