]> granicus.if.org Git - php/commitdiff
Switch hash() function to use fastzpp
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 30 Dec 2019 17:04:07 +0000 (18:04 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 2 Jan 2020 09:06:16 +0000 (10:06 +0100)
For short inputs ZPP can be a large fraction of the hash()
execution time.

ext/hash/hash.c

index 3aedec6554899149eeb4b9d83e16d29b7bdd715c..34dccfb32ad9db69901b3a615bc0a13c12d670fa 100644 (file)
@@ -123,9 +123,12 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
        void *context;
        php_stream *stream = NULL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &algo, &data, &data_len, &raw_output) == FAILURE) {
-               RETURN_THROWS();
-       }
+       ZEND_PARSE_PARAMETERS_START(2, 3)
+               Z_PARAM_STR(algo)
+               Z_PARAM_STRING(data, data_len)
+               Z_PARAM_OPTIONAL
+               Z_PARAM_BOOL(raw_output)
+       ZEND_PARSE_PARAMETERS_END();
 
        ops = php_hash_fetch_ops(algo);
        if (!ops) {