summaryrefslogtreecommitdiff
path: root/ext/standard/php_smart_str.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/php_smart_str.h')
-rw-r--r--ext/standard/php_smart_str.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
index 8146a057d3..e90e664eb2 100644
--- a/ext/standard/php_smart_str.h
+++ b/ext/standard/php_smart_str.h
@@ -80,6 +80,7 @@ static inline char *smart_str_print_long(char *buf, long num)
{
char *p = buf;
long tmp = 0;
+ int n = 0;
if (num < 0) {
num = -num;
@@ -89,12 +90,13 @@ static inline char *smart_str_print_long(char *buf, long num)
while (num > 0) {
tmp = tmp * 10 + (num % 10);
num /= 10;
+ n++;
}
do {
*p++ = (tmp % 10) + '0';
tmp /= 10;
- } while (tmp > 0);
+ } while (--n > 0);
return p;
}