57
57
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
58
58
*/
59
59
60
- static char * __cvt (double value , int ndigit , int * decpt , int * sign , int fmode , int pad ) /* {{{ */
60
+ static char * __cvt (double value , int ndigit , int * decpt , bool * sign , int fmode , int pad ) /* {{{ */
61
61
{
62
62
register char * s = NULL ;
63
63
char * p , * rve , c ;
@@ -116,13 +116,13 @@ static char * __cvt(double value, int ndigit, int *decpt, int *sign, int fmode,
116
116
}
117
117
/* }}} */
118
118
119
- static inline char * php_ecvt (double value , int ndigit , int * decpt , int * sign ) /* {{{ */
119
+ static inline char * php_ecvt (double value , int ndigit , int * decpt , bool * sign ) /* {{{ */
120
120
{
121
121
return (__cvt (value , ndigit , decpt , sign , 0 , 1 ));
122
122
}
123
123
/* }}} */
124
124
125
- static inline char * php_fcvt (double value , int ndigit , int * decpt , int * sign ) /* {{{ */
125
+ static inline char * php_fcvt (double value , int ndigit , int * decpt , bool * sign ) /* {{{ */
126
126
{
127
127
return (__cvt (value , ndigit , decpt , sign , 1 , 1 ));
128
128
}
@@ -131,7 +131,8 @@ static inline char *php_fcvt(double value, int ndigit, int *decpt, int *sign) /*
131
131
PHPAPI char * php_gcvt (double value , int ndigit , char dec_point , char exponent , char * buf ) /* {{{ */
132
132
{
133
133
char * digits , * dst , * src ;
134
- int i , decpt , sign ;
134
+ int i , decpt ;
135
+ bool sign ;
135
136
int mode = ndigit >= 0 ? 2 : 0 ;
136
137
137
138
if (mode == 0 ) {
@@ -182,7 +183,8 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c
182
183
* dst = '\0' ;
183
184
} else {
184
185
/* XXX - optimize */
185
- for (sign = decpt , i = 0 ; (sign /= 10 ) != 0 ; i ++ );
186
+ int n ;
187
+ for (n = decpt , i = 0 ; (n /= 10 ) != 0 ; i ++ );
186
188
dst [i + 1 ] = '\0' ;
187
189
while (decpt != 0 ) {
188
190
dst [i -- ] = '0' + decpt % 10 ;
@@ -283,8 +285,6 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c
283
285
*/
284
286
/* }}} */
285
287
286
- #define FALSE 0
287
- #define TRUE 1
288
288
#define NUL '\0'
289
289
#define INT_NULL ((int *)0)
290
290
@@ -300,23 +300,23 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c
300
300
* Return value:
301
301
* - a pointer to a string containing the number (no sign)
302
302
* - len contains the length of the string
303
- * - is_negative is set to TRUE or FALSE depending on the sign
304
- * of the number (always set to FALSE if is_unsigned is TRUE )
303
+ * - is_negative is set to true or false depending on the sign
304
+ * of the number (always set to false if is_unsigned is true )
305
305
*
306
306
* The caller provides a buffer for the string: that is the buf_end argument
307
307
* which is a pointer to the END of the buffer + 1 (i.e. if the buffer
308
308
* is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
309
309
*/
310
310
/* char * ap_php_conv_10() {{{ */
311
- PHPAPI char * ap_php_conv_10 (register wide_int num , register bool_int is_unsigned ,
312
- register bool_int * is_negative , char * buf_end , register size_t * len )
311
+ PHPAPI char * ap_php_conv_10 (register wide_int num , register bool is_unsigned ,
312
+ register bool * is_negative , char * buf_end , register size_t * len )
313
313
{
314
314
register char * p = buf_end ;
315
315
register u_wide_int magnitude ;
316
316
317
317
if (is_unsigned ) {
318
318
magnitude = (u_wide_int ) num ;
319
- * is_negative = FALSE ;
319
+ * is_negative = false ;
320
320
} else {
321
321
* is_negative = (num < 0 );
322
322
@@ -367,7 +367,7 @@ PHPAPI char * ap_php_conv_10(register wide_int num, register bool_int is_unsigne
367
367
*/
368
368
/* PHPAPI char * php_conv_fp() {{{ */
369
369
PHPAPI char * php_conv_fp (register char format , register double num ,
370
- boolean_e add_dp , int precision , char dec_point , bool_int * is_negative , char * buf , size_t * len )
370
+ boolean_e add_dp , int precision , char dec_point , bool * is_negative , char * buf , size_t * len )
371
371
{
372
372
register char * s = buf ;
373
373
register char * p , * p_orig ;
@@ -389,7 +389,7 @@ PHPAPI char * php_conv_fp(register char format, register double num,
389
389
if (isalpha ((int )* p )) {
390
390
* len = strlen (p );
391
391
memcpy (buf , p , * len + 1 );
392
- * is_negative = FALSE ;
392
+ * is_negative = false ;
393
393
free (p_orig );
394
394
return (buf );
395
395
}
@@ -436,12 +436,12 @@ PHPAPI char * php_conv_fp(register char format, register double num,
436
436
if (format != 'F' ) {
437
437
char temp [EXPONENT_LENGTH ]; /* for exponent conversion */
438
438
size_t t_len ;
439
- bool_int exponent_is_negative ;
439
+ bool exponent_is_negative ;
440
440
441
441
* s ++ = format ; /* either e or E */
442
442
decimal_point -- ;
443
443
if (decimal_point != 0 ) {
444
- p = ap_php_conv_10 ((wide_int ) decimal_point , FALSE , & exponent_is_negative , & temp [EXPONENT_LENGTH ], & t_len );
444
+ p = ap_php_conv_10 ((wide_int ) decimal_point , false , & exponent_is_negative , & temp [EXPONENT_LENGTH ], & t_len );
445
445
* s ++ = exponent_is_negative ? '-' : '+' ;
446
446
447
447
/*
@@ -616,7 +616,7 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
616
616
boolean_e print_blank ;
617
617
boolean_e adjust_precision ;
618
618
boolean_e adjust_width ;
619
- bool_int is_negative ;
619
+ bool is_negative ;
620
620
621
621
sp = odp -> nextb ;
622
622
bep = odp -> buf_end ;
0 commit comments