Skip to content

Commit a7d635a

Browse files
DanielEScherzerremicollet
authored andcommitted
xpass: voidify get_options()
This function always returned `true`; removing the return type revealed some impossible code for handling `false` that could also be removed.
1 parent 7a080d8 commit a7d635a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

xpass.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,16 @@ PHP_MINFO_FUNCTION(xpass)
6262
}
6363
/* }}} */
6464

65-
static bool get_options(zend_array *options, zend_ulong *cost) {
65+
static void get_options(zend_array *options, zend_ulong *cost) {
6666
zval *opt;
6767

6868
*cost = 0;
6969
if (!options) {
70-
return true;
70+
return;
7171
}
7272
if ((opt = zend_hash_str_find(options, "cost", strlen("cost")))) {
7373
*cost = zval_get_long(opt);
7474
}
75-
return true;
7675
}
7776

7877

@@ -82,9 +81,7 @@ static zend_string *php_xpass_hash(const zend_string *password, zend_array *opti
8281

8382
memset(&data, 0, sizeof(data));
8483

85-
if (!get_options(options, &cost)) {
86-
return NULL;
87-
}
84+
get_options(options, &cost);
8885
if ((ZSTR_LEN(password) >= CRYPT_MAX_PASSPHRASE_SIZE)) {
8986
zend_value_error("Password is too long");
9087
return NULL;

0 commit comments

Comments
 (0)