From: Sascha Schumann Date: Fri, 3 Aug 2001 11:09:13 +0000 (+0000) Subject: Treat trailing zeroes correctly X-Git-Tag: PRE_ENGINE2_SPLIT~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6dc2ba6bc17952188119028515ecf376c587348;p=php Treat trailing zeroes correctly --- 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; }