mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
sodium: Use return true / return false for functions returning bool
Changes done with Coccinelle:
@r1@
identifier fn;
typedef bool;
symbol false;
symbol true;
@@
bool fn ( ... )
{
<...
return
(
- 0
+ false
|
- 1
+ true
)
;
...>
}
Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
This commit is contained in:
committed by
Tim Düsterhus
parent
70117e53b9
commit
5dfa85992a
@@ -87,7 +87,7 @@ static zend_string *php_sodium_argon2_hash(const zend_string *password, zend_arr
|
||||
|
||||
static bool php_sodium_argon2_verify(const zend_string *password, const zend_string *hash) {
|
||||
if ((ZSTR_LEN(password) >= 0xffffffff) || (ZSTR_LEN(hash) >= 0xffffffff)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
return crypto_pwhash_str_verify(ZSTR_VAL(hash), ZSTR_VAL(password), ZSTR_LEN(password)) == 0;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ static bool php_sodium_argon2_needs_rehash(const zend_string *hash, zend_array *
|
||||
size_t opslimit, memlimit;
|
||||
|
||||
if (get_options(options, &memlimit, &opslimit) == FAILURE) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return crypto_pwhash_str_needs_rehash(ZSTR_VAL(hash), opslimit, memlimit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user