From d6dc2ba6bc17952188119028515ecf376c587348 Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Fri, 3 Aug 2001 11:09:13 +0000 Subject: [PATCH] Treat trailing zeroes correctly --- ext/standard/php_smart_str.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.50.1