]> granicus.if.org Git - php/commitdiff
Fix bug #60596: Code Cleanup Removing Superfluous If Statement
authorNikita Popov <nikic@php.net>
Sun, 4 Mar 2012 13:52:48 +0000 (13:52 +0000)
committerNikita Popov <nikic@php.net>
Sun, 4 Mar 2012 13:52:48 +0000 (13:52 +0000)
Cleanup only, no function change. Patch by ircmaxell.

ext/spl/spl_engine.c

index 9273308b13d4b32ed8c4b05c68497912d031b45e..d501f314352bb5ffa97419128d593da7eec1c4a3 100755 (executable)
@@ -45,19 +45,16 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRM
 
 PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */
 {
-       switch(Z_TYPE_P(offset)) {
+       switch (Z_TYPE_P(offset)) {
        case IS_STRING:
                ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, idx);
                break;
        case IS_DOUBLE:
+               return (long)Z_DVAL_P(offset);
        case IS_RESOURCE:
        case IS_BOOL:
        case IS_LONG:
-               if (Z_TYPE_P(offset) == IS_DOUBLE) {
-                       return (long)Z_DVAL_P(offset);
-               } else {
-                       return Z_LVAL_P(offset);
-               }
+               return Z_LVAL_P(offset);
        }
        return -1;
 }