Re: cvs: php-src /ext/standard math.c
| From: | Andrei Zmievski | Date: | Wed, 27 Dec 2006 19:21:06 +0000 |
| Subject: | Re: cvs: php-src /ext/standard math.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-42433@lists.php.net to get a copy of this message | ||
On Dec 27, 2006, at 11:07 AM, Antony Dovgal wrote:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|ls&s&", &num, &dec, - &sep1, &sep1_len, UG(ascii_conv), - &sep2, &sep2_len, UG(ascii_conv)) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|lzz", &num, &dec, &sep1, &sep2) == FAILURE) { return; }Why not use '!' modifier to say that the arg can be NULL? The the code below is not necessary.
- if (sep1) { - if (sep1_len >= 1) { - dec_point = sep1[0]; - } else if (sep1_len == 0) { + if (sep1 && Z_TYPE_P(sep1) != IS_NULL) { + convert_to_string_with_converter(sep1, UG(ascii_conv)); + if (Z_STRLEN_P(sep1)) { + dec_point = Z_STRVAL_P(sep1)[0]; + } else { dec_point = 0;If you don't want to use '!', at least check for return value of convert_to_string_with_converter() and fail, if needed. -Andrei