1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

hash: Use true / false instead of 1 / 0 for bool parameters

Changes done with Coccinelle:

    @r1@
    identifier F;
    identifier p;
    typedef bool;
    parameter list [n1] PL1;
    parameter list [n2] PL2;
    @@

    F(PL1, bool p, PL2) {
    ...
    }

    @r2@
    identifier r1.F;
    expression list [r1.n1] EL1;
    expression list [r1.n2] EL2;
    @@

    F(EL1,
    (
    - 1
    + true
    |
    - 0
    + false
    )
    , EL2)
This commit is contained in:
Tim Düsterhus
2025-09-23 23:26:53 +02:00
committed by Tim Düsterhus
parent 3e30deda09
commit 0768a16a23

View File

@@ -583,7 +583,7 @@ PHP_FUNCTION(hash_hmac)
RETURN_THROWS();
}
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, raw_output, 0);
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, raw_output, false);
}
/* }}} */
@@ -600,7 +600,7 @@ PHP_FUNCTION(hash_hmac_file)
RETURN_THROWS();
}
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, raw_output, 1);
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, raw_output, true);
}
/* }}} */
@@ -1227,9 +1227,9 @@ PHP_FUNCTION(mhash)
}
if (key) {
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, 1, 0);
php_hash_do_hash_hmac(return_value, algo, data, data_len, key, key_len, true, false);
} else {
php_hash_do_hash(return_value, algo, data, data_len, 1, 0, NULL);
php_hash_do_hash(return_value, algo, data, data_len, true, false, NULL);
}
if (algo) {