diff options
author | Zeev Suraski <zeev@php.net> | 1999-04-24 00:12:00 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-04-24 00:12:00 +0000 |
commit | 0818d96c97ceec4dbb8251c5220a2fdcdf39f355 (patch) | |
tree | c56f529e445e4bee928e7c28e0ccbb7f67572f16 /ext/standard/formatted_print.c | |
parent | 05d24c60223439b94d4100538331fb6749022ca3 (diff) | |
download | php-git-0818d96c97ceec4dbb8251c5220a2fdcdf39f355.tar.gz |
A lot of cleanups... Removed old thread-safe code and other redundant code and files
Diffstat (limited to 'ext/standard/formatted_print.c')
-rw-r--r-- | ext/standard/formatted_print.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 4efb949292..094c29c8d6 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -79,30 +79,29 @@ _php3_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) #ifndef THREAD_SAFE static char cvt_buf[NDIG]; #endif - TLS_VARS; if (ndigits >= NDIG - 1) ndigits = NDIG - 2; r2 = 0; *sign = 0; - p = &STATIC(cvt_buf)[0]; + p = &cvt_buf[0]; if (arg < 0) { *sign = 1; arg = -arg; } arg = modf(arg, &fi); - p1 = &STATIC(cvt_buf)[NDIG]; + p1 = &cvt_buf[NDIG]; /* * Do integer part */ if (fi != 0) { - p1 = &STATIC(cvt_buf)[NDIG]; + p1 = &cvt_buf[NDIG]; while (fi != 0) { fj = modf(fi / 10, &fi); *--p1 = (int) ((fj + .03) * 10) + '0'; r2++; } - while (p1 < &STATIC(cvt_buf)[NDIG]) + while (p1 < &cvt_buf[NDIG]) *p++ = *p1++; } else if (arg > 0) { while ((fj = arg * 10) < 1) { @@ -110,41 +109,41 @@ _php3_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag) r2--; } } - p1 = &STATIC(cvt_buf)[ndigits]; + p1 = &cvt_buf[ndigits]; if (eflag == 0) p1 += r2; *decpt = r2; - if (p1 < &STATIC(cvt_buf)[0]) { - STATIC(cvt_buf)[0] = '\0'; - return (STATIC(cvt_buf)); + if (p1 < &cvt_buf[0]) { + cvt_buf[0] = '\0'; + return (cvt_buf); } - while (p <= p1 && p < &STATIC(cvt_buf)[NDIG]) { + while (p <= p1 && p < &cvt_buf[NDIG]) { arg *= 10; arg = modf(arg, &fj); *p++ = (int) fj + '0'; } - if (p1 >= &STATIC(cvt_buf)[NDIG]) { - STATIC(cvt_buf)[NDIG - 1] = '\0'; - return (STATIC(cvt_buf)); + if (p1 >= &cvt_buf[NDIG]) { + cvt_buf[NDIG - 1] = '\0'; + return (cvt_buf); } p = p1; *p1 += 5; while (*p1 > '9') { *p1 = '0'; - if (p1 > STATIC(cvt_buf)) + if (p1 > cvt_buf) ++ * --p1; else { *p1 = '1'; (*decpt)++; if (eflag == 0) { - if (p > STATIC(cvt_buf)) + if (p > cvt_buf) *p = '0'; p++; } } } *p = '\0'; - return (STATIC(cvt_buf)); + return (cvt_buf); } @@ -567,7 +566,6 @@ PHP_FUNCTION(user_sprintf) { char *result; int len; - TLS_VARS; if ((result=php3_formatted_print(ht,&len))==NULL) { RETURN_FALSE; @@ -581,7 +579,6 @@ PHP_FUNCTION(user_printf) { char *result; int len; - TLS_VARS; if ((result=php3_formatted_print(ht,&len))==NULL) { RETURN_FALSE; |