diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-06-30 04:05:24 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-06-30 04:05:24 +0300 |
commit | 4a2e40bb861bc3cf5fb6863e57486ed60316e97c (patch) | |
tree | 6579660b282fdd1bc50095e48d702913a0b6aa97 /ext/standard/math.c | |
parent | 8cce5b2641fb91c3073018b59f6f044b843041a8 (diff) | |
download | php-git-4a2e40bb861bc3cf5fb6863e57486ed60316e97c.tar.gz |
Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes).
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r-- | ext/standard/math.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c index 8d041d55df..33c83626a1 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1292,23 +1292,23 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin tmpbuf = strpprintf(0, "%.*F", dec, d); if (tmpbuf == NULL) { return NULL; - } else if (!isdigit((int)tmpbuf->val[0])) { + } else if (!isdigit((int)ZSTR_VAL(tmpbuf)[0])) { return tmpbuf; } /* find decimal point, if expected */ if (dec) { - dp = strpbrk(tmpbuf->val, ".,"); + dp = strpbrk(ZSTR_VAL(tmpbuf), ".,"); } else { dp = NULL; } /* calculate the length of the return buffer */ if (dp) { - integral = (int)(dp - tmpbuf->val); + integral = (int)(dp - ZSTR_VAL(tmpbuf)); } else { /* no decimal point was found */ - integral = (int)tmpbuf->len; + integral = (int)ZSTR_LEN(tmpbuf); } /* allow for thousand separators */ @@ -1332,8 +1332,8 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin } res = zend_string_alloc(reslen, 0); - s = tmpbuf->val + tmpbuf->len - 1; - t = res->val + reslen; + s = ZSTR_VAL(tmpbuf) + ZSTR_LEN(tmpbuf) - 1; + t = ZSTR_VAL(res) + reslen; *t-- = '\0'; /* copy the decimal places. @@ -1365,9 +1365,9 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin /* copy the numbers before the decimal point, adding thousand * separator every three digits */ - while (s >= tmpbuf->val) { + while (s >= ZSTR_VAL(tmpbuf)) { *t-- = *s--; - if (thousand_sep && (++count%3)==0 && s>=tmpbuf->val) { + if (thousand_sep && (++count%3)==0 && s >= ZSTR_VAL(tmpbuf)) { t -= thousand_sep_len; memcpy(t + 1, thousand_sep, thousand_sep_len); } @@ -1378,7 +1378,7 @@ PHPAPI zend_string *_php_math_number_format_ex(double d, int dec, char *dec_poin *t-- = '-'; } - res->len = reslen; + ZSTR_LEN(res) = reslen; zend_string_release(tmpbuf); return res; } |