]> granicus.if.org Git - php/commitdiff
minor changes in iconv_substr() to avoid zval converting
authorAntony Dovgal <tony2001@php.net>
Thu, 31 Aug 2006 11:17:37 +0000 (11:17 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 31 Aug 2006 11:17:37 +0000 (11:17 +0000)
ext/iconv/iconv.c

index b7e5fa322091c6493072fc21bd9a7ad84ecbc9fa..152bbe25a0a0170ca2ab71af58e826fef09d23bc 100644 (file)
@@ -1886,7 +1886,6 @@ PHP_FUNCTION(iconv_substr)
        char *str;
        int str_len; 
        long offset, length;
-       zval *len_z = NULL;
 
        php_iconv_err_t err;
 
@@ -1894,17 +1893,14 @@ PHP_FUNCTION(iconv_substr)
 
        charset = ICONVG(internal_encoding);
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|zs",
-               &str, &str_len, &offset, &len_z,
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls",
+               &str, &str_len, &offset, &length,
                &charset, &charset_len) == FAILURE) {
                RETURN_FALSE;
        }
 
-       if (len_z == NULL) {
+       if (ZEND_NUM_ARGS() < 3) {
                length = str_len; 
-       } else {
-               convert_to_long_ex(&len_z);
-               length = Z_LVAL_P(len_z);
        }
 
        err = _php_iconv_substr(&retval, str, str_len, offset, length, charset);