diff options
| author | Sascha Schumann <sas@php.net> | 2001-08-03 11:09:13 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 2001-08-03 11:09:13 +0000 |
| commit | d6dc2ba6bc17952188119028515ecf376c587348 (patch) | |
| tree | 02c4375dd9217ddedc3379c9b952a2f6ace21d85 /ext/standard/php_smart_str.h | |
| parent | 723bbcbea02f5ec010c2fd29b89049c804d6f384 (diff) | |
| download | php-git-d6dc2ba6bc17952188119028515ecf376c587348.tar.gz | |
Treat trailing zeroes correctly
Diffstat (limited to 'ext/standard/php_smart_str.h')
| -rw-r--r-- | ext/standard/php_smart_str.h | 4 |
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; } |
