]> granicus.if.org Git - php/commitdiff
Remove unnecessary condition as always true.
authorGeorge Peter Banyard <girgias@php.net>
Wed, 5 Feb 2020 16:44:20 +0000 (17:44 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Wed, 5 Feb 2020 16:44:20 +0000 (17:44 +0100)
ZSTR_LEN(str) is an unsigned integer therefor it is always greater
or equal than 0.

Detected by -Wtype-limits compiler warning.

ext/iconv/iconv.c

index 7267632dd40fd7e5a9a67dc893e378b24d6e5b26..36fdcf619816d50aef00ac391511b884244150ab 100644 (file)
@@ -2052,7 +2052,7 @@ PHP_FUNCTION(iconv_substr)
        err = _php_iconv_substr(&retval, ZSTR_VAL(str), ZSTR_LEN(str), offset, length, charset);
        _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
 
-       if (err == PHP_ICONV_ERR_SUCCESS && ZSTR_LEN(str) >= 0 && retval.s != NULL) {
+       if (err == PHP_ICONV_ERR_SUCCESS && retval.s != NULL) {
                RETURN_NEW_STR(retval.s);
        }
        smart_str_free(&retval);