]> granicus.if.org Git - php/commitdiff
Refactor slightly to enable cleaner readability
authorAnthony Ferrara <ircmaxell@gmail.com>
Mon, 17 Sep 2012 15:43:47 +0000 (11:43 -0400)
committerAnthony Ferrara <ircmaxell@gmail.com>
Mon, 17 Sep 2012 15:43:47 +0000 (11:43 -0400)
ext/standard/password.c

index 8e9d8941b578cc86e36fa4db46776fc0a2c97193..e8762690bb5b66e9f96d48ab4862bbcdb858893c 100644 (file)
@@ -242,16 +242,16 @@ PHP_FUNCTION(password_needs_rehash)
        switch (algo) {
                case PHP_PASSWORD_BCRYPT:
                        {
-                               int newCost = PHP_PASSWORD_BCRYPT_COST, cost = 0;
+                               long new_cost = PHP_PASSWORD_BCRYPT_COST, cost = 0;
                                
-                               if (options && zend_symtable_find(options, "cost", 5, (void **) &option_buffer) == SUCCESS) {
+                               if (options && zend_symtable_find(options, "cost", sizeof("cost"), (void **) &option_buffer) == SUCCESS) {
                                        convert_to_long_ex(option_buffer);
-                                       newCost = Z_LVAL_PP(option_buffer);
+                                       new_cost = Z_LVAL_PP(option_buffer);
                                        zval_ptr_dtor(option_buffer);
                                }
 
-                               sscanf(hash, "$2y$%d$", &cost);
-                               if (cost != newCost) {
+                               sscanf(hash, "$2y$%ld$", &cost);
+                               if (cost != new_cost) {
                                        RETURN_TRUE;
                                }
                        }