Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-03 Thread Rasmus Lerdorf
 Regardless, I think the ideal answer is for everyone to just follow
 the same standard from the beginning.  If we all did that, there would
 be no reason for style- or whitespace-related commits.

Yes, but that is simply never going to happen as even a brief look at the
current code will attest to.  I'd just like to keep the extranenous WS/CS
commits to a minimum and only for the most serious cases.  ie. don't
change a=1 to a = 1 in someone's code when we have thousands of those
already in the code and it really is not a serious CS violation at all.

-Rasmus

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-03 Thread Jani Taskinen
On Wed, 2 Apr 2003, Rasmus Lerdorf wrote:

Oh, give me a break Jani.  A space here or there makes absolutely no
difference to the readability of the code, but all these whitespace
commits get in the way of any real work when trying to track down problems
via cvs diffs.

If you had committed correct style code in the first place,
I wouldn't have to make the 2nd commit on it. Hence the note
about not committing code like that anymore.

--Jani


On Thu, 3 Apr 2003, Jani Taskinen wrote:

 sniper   Wed Apr  2 20:16:34 2003 EDT

   Modified files:
 /php4/ext/bcmath bcmath.c
   Log:
   Another CS fix.
   # Rasmus, at least try keep the style consistent..


 Index: php4/ext/bcmath/bcmath.c
 diff -u php4/ext/bcmath/bcmath.c:1.53 php4/ext/bcmath/bcmath.c:1.54
 --- php4/ext/bcmath/bcmath.c:1.53Wed Apr  2 18:51:52 2003
 +++ php4/ext/bcmath/bcmath.c Wed Apr  2 20:16:34 2003
 @@ -16,7 +16,7 @@
 +--+
  */

 -/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
 +/* $Id: bcmath.c,v 1.54 2003/04/03 01:16:34 sniper Exp $ */

  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -97,7 +97,11 @@
  if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
  bc_precision = 0;
  }
 -if(bc_precision0) bc_precision=0;
 +
 +if (bc_precision  0) {
 +bc_precision = 0;
 +}
 +
  bc_init_numbers(TSRMLS_C);

  return SUCCESS;
 @@ -145,7 +149,7 @@
  WRONG_PARAM_COUNT;
  }
  convert_to_long_ex(scale_param);
 -scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 +scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
  break;
  default:
  WRONG_PARAM_COUNT;
 @@ -191,7 +195,7 @@
  WRONG_PARAM_COUNT;
  }
  convert_to_long_ex(scale_param);
 -scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 +scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
  break;
  default:
  WRONG_PARAM_COUNT;
 @@ -237,7 +241,7 @@
  WRONG_PARAM_COUNT;
  }
  convert_to_long_ex(scale_param);
 -scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 +scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
  break;
  default:
  WRONG_PARAM_COUNT;
 @@ -283,7 +287,7 @@
  WRONG_PARAM_COUNT;
  }
  convert_to_long_ex(scale_param);
 -scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 +scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
  break;
  default:
  WRONG_PARAM_COUNT;
 @@ -296,7 +300,7 @@
  bc_init_num(result TSRMLS_CC);
  php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
  php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
 -switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
 +switch (bc_divide(first, second, result, scale TSRMLS_CC)) {
  case 0: /* OK */
  if (result-n_scale  scale) {
  result-n_scale = scale;
 @@ -411,7 +415,7 @@
  WRONG_PARAM_COUNT;
  }
  convert_to_long_ex(scale_param);
 -scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 +scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
  break;
  default:
  WRONG_PARAM_COUNT;
 @@ -457,7 +461,7 @@
  WRONG_PARAM_COUNT;
  }
  convert_to_long_ex(scale_param);
 -scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 +scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
  break;
  default:
  WRONG_PARAM_COUNT;
 @@ -500,7 +504,7 @@
  WRONG_PARAM_COUNT;
  }
  

[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Rasmus Lerdorf
rasmus  Wed Apr  2 18:51:52 2003 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  MFB: Check for negative precision
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.52 php4/ext/bcmath/bcmath.c:1.53
--- php4/ext/bcmath/bcmath.c:1.52   Wed Mar 19 19:22:57 2003
+++ php4/ext/bcmath/bcmath.cWed Apr  2 18:51:52 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.52 2003/03/20 00:22:57 sniper Exp $ */
+/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -97,7 +97,7 @@
if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
bc_precision = 0;
}
-   
+   if(bc_precision0) bc_precision=0;
bc_init_numbers(TSRMLS_C);

return SUCCESS;
@@ -145,7 +145,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -191,7 +191,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -237,7 +237,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -283,7 +283,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -411,7 +411,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -457,7 +457,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -500,7 +500,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -534,7 +534,8 @@
}

convert_to_long_ex(new_scale);
-   bc_precision = Z_LVAL_PP(new_scale);
+   bc_precision = (Z_LVAL_PP(new_scale)0) ? 0 : Z_LVAL_PP(new_scale);
+
RETURN_TRUE;
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Jani Taskinen
sniper  Wed Apr  2 20:16:34 2003 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  Another CS fix.
  # Rasmus, at least try keep the style consistent..
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.53 php4/ext/bcmath/bcmath.c:1.54
--- php4/ext/bcmath/bcmath.c:1.53   Wed Apr  2 18:51:52 2003
+++ php4/ext/bcmath/bcmath.cWed Apr  2 20:16:34 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
+/* $Id: bcmath.c,v 1.54 2003/04/03 01:16:34 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -97,7 +97,11 @@
if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
bc_precision = 0;
}
-   if(bc_precision0) bc_precision=0;
+
+   if (bc_precision  0) {
+   bc_precision = 0;
+   }
+   
bc_init_numbers(TSRMLS_C);

return SUCCESS;
@@ -145,7 +149,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -191,7 +195,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -237,7 +241,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -283,7 +287,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -296,7 +300,7 @@
bc_init_num(result TSRMLS_CC);
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
-   switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
+   switch (bc_divide(first, second, result, scale TSRMLS_CC)) {
case 0: /* OK */
if (result-n_scale  scale) {
result-n_scale = scale;
@@ -411,7 +415,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -457,7 +461,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -500,7 +504,7 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(scale_param);
-   scale = (int) (Z_LVAL_PP(scale_param)0) ? 
0:Z_LVAL_PP(scale_param);
+   scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
Z_LVAL_PP(scale_param);
break;
default:
WRONG_PARAM_COUNT;
@@ -534,7 +538,7 @@
}

 

Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Rasmus Lerdorf
Oh, give me a break Jani.  A space here or there makes absolutely no
difference to the readability of the code, but all these whitespace
commits get in the way of any real work when trying to track down problems
via cvs diffs.

On Thu, 3 Apr 2003, Jani Taskinen wrote:

 sniperWed Apr  2 20:16:34 2003 EDT

   Modified files:
 /php4/ext/bcmath  bcmath.c
   Log:
   Another CS fix.
   # Rasmus, at least try keep the style consistent..


 Index: php4/ext/bcmath/bcmath.c
 diff -u php4/ext/bcmath/bcmath.c:1.53 php4/ext/bcmath/bcmath.c:1.54
 --- php4/ext/bcmath/bcmath.c:1.53 Wed Apr  2 18:51:52 2003
 +++ php4/ext/bcmath/bcmath.c  Wed Apr  2 20:16:34 2003
 @@ -16,7 +16,7 @@
 +--+
  */

 -/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
 +/* $Id: bcmath.c,v 1.54 2003/04/03 01:16:34 sniper Exp $ */

  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -97,7 +97,11 @@
   if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
   bc_precision = 0;
   }
 - if(bc_precision0) bc_precision=0;
 +
 + if (bc_precision  0) {
 + bc_precision = 0;
 + }
 +
   bc_init_numbers(TSRMLS_C);

   return SUCCESS;
 @@ -145,7 +149,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -191,7 +195,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -237,7 +241,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -283,7 +287,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -296,7 +300,7 @@
   bc_init_num(result TSRMLS_CC);
   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
 - switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
 + switch (bc_divide(first, second, result, scale TSRMLS_CC)) {
   case 0: /* OK */
   if (result-n_scale  scale) {
   result-n_scale = scale;
 @@ -411,7 +415,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -457,7 +461,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  0) ? 0 : 
 Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -500,7 +504,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) ? 
 0:Z_LVAL_PP(scale_param);
 + scale = (int) 

Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Andi Gutmans
I agree with him. We have standards and people have worked hard to indent 
the source code in a consistent manner (especially people like Jani). It 
doesn't take more time to indent nicely.

Andi

At 06:54 PM 4/2/2003 -0800, Rasmus Lerdorf wrote:
Oh, give me a break Jani.  A space here or there makes absolutely no
difference to the readability of the code, but all these whitespace
commits get in the way of any real work when trying to track down problems
via cvs diffs.
On Thu, 3 Apr 2003, Jani Taskinen wrote:

 sniperWed Apr  2 20:16:34 2003 EDT

   Modified files:
 /php4/ext/bcmath  bcmath.c
   Log:
   Another CS fix.
   # Rasmus, at least try keep the style consistent..


 Index: php4/ext/bcmath/bcmath.c
 diff -u php4/ext/bcmath/bcmath.c:1.53 php4/ext/bcmath/bcmath.c:1.54
 --- php4/ext/bcmath/bcmath.c:1.53 Wed Apr  2 18:51:52 2003
 +++ php4/ext/bcmath/bcmath.c  Wed Apr  2 20:16:34 2003
 @@ -16,7 +16,7 @@
 
+--+
  */

 -/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
 +/* $Id: bcmath.c,v 1.54 2003/04/03 01:16:34 sniper Exp $ */

  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -97,7 +97,11 @@
   if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
   bc_precision = 0;
   }
 - if(bc_precision0) bc_precision=0;
 +
 + if (bc_precision  0) {
 + bc_precision = 0;
 + }
 +
   bc_init_numbers(TSRMLS_C);

   return SUCCESS;
 @@ -145,7 +149,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) 
? 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  
0) ? 0 : Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -191,7 +195,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) 
? 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  
0) ? 0 : Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -237,7 +241,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) 
? 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  
0) ? 0 : Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -283,7 +287,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) 
? 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  
0) ? 0 : Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -296,7 +300,7 @@
   bc_init_num(result TSRMLS_CC);
   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
 - switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
 + switch (bc_divide(first, second, result, scale TSRMLS_CC)) {
   case 0: /* OK */
   if (result-n_scale  scale) {
   result-n_scale = scale;
 @@ -411,7 +415,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) 
? 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  
0) ? 0 : Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -457,7 +461,7 @@
   WRONG_PARAM_COUNT;
   }
   convert_to_long_ex(scale_param);
 - scale = (int) (Z_LVAL_PP(scale_param)0) 
? 0:Z_LVAL_PP(scale_param);
 + scale = (int) (Z_LVAL_PP(scale_param)  
0) ? 0 : Z_LVAL_PP(scale_param);
   break;
   default:
   WRONG_PARAM_COUNT;
 @@ -500,7 +504,7 @@
   WRONG_PARAM_COUNT;
 

Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Rasmus Lerdorf
There was nothing wrong with the indentation.  He changed ab to a  b and
minor things like that.  That's just cvs noise.

On Thu, 3 Apr 2003, Andi Gutmans wrote:

 I agree with him. We have standards and people have worked hard to indent
 the source code in a consistent manner (especially people like Jani). It
 doesn't take more time to indent nicely.

 Andi

 At 06:54 PM 4/2/2003 -0800, Rasmus Lerdorf wrote:
 Oh, give me a break Jani.  A space here or there makes absolutely no
 difference to the readability of the code, but all these whitespace
 commits get in the way of any real work when trying to track down problems
 via cvs diffs.
 
 On Thu, 3 Apr 2003, Jani Taskinen wrote:
 
   sniperWed Apr  2 20:16:34 2003 EDT
  
 Modified files:
   /php4/ext/bcmath  bcmath.c
 Log:
 Another CS fix.
 # Rasmus, at least try keep the style consistent..
  
  
   Index: php4/ext/bcmath/bcmath.c
   diff -u php4/ext/bcmath/bcmath.c:1.53 php4/ext/bcmath/bcmath.c:1.54
   --- php4/ext/bcmath/bcmath.c:1.53 Wed Apr  2 18:51:52 2003
   +++ php4/ext/bcmath/bcmath.c  Wed Apr  2 20:16:34 2003
   @@ -16,7 +16,7 @@
  
  +--+
*/
  
   -/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
   +/* $Id: bcmath.c,v 1.54 2003/04/03 01:16:34 sniper Exp $ */
  
#ifdef HAVE_CONFIG_H
#include config.h
   @@ -97,7 +97,11 @@
 if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
 bc_precision = 0;
 }
   - if(bc_precision0) bc_precision=0;
   +
   + if (bc_precision  0) {
   + bc_precision = 0;
   + }
   +
 bc_init_numbers(TSRMLS_C);
  
 return SUCCESS;
   @@ -145,7 +149,7 @@
 WRONG_PARAM_COUNT;
 }
 convert_to_long_ex(scale_param);
   - scale = (int) (Z_LVAL_PP(scale_param)0)
  ? 0:Z_LVAL_PP(scale_param);
   + scale = (int) (Z_LVAL_PP(scale_param) 
  0) ? 0 : Z_LVAL_PP(scale_param);
 break;
 default:
 WRONG_PARAM_COUNT;
   @@ -191,7 +195,7 @@
 WRONG_PARAM_COUNT;
 }
 convert_to_long_ex(scale_param);
   - scale = (int) (Z_LVAL_PP(scale_param)0)
  ? 0:Z_LVAL_PP(scale_param);
   + scale = (int) (Z_LVAL_PP(scale_param) 
  0) ? 0 : Z_LVAL_PP(scale_param);
 break;
 default:
 WRONG_PARAM_COUNT;
   @@ -237,7 +241,7 @@
 WRONG_PARAM_COUNT;
 }
 convert_to_long_ex(scale_param);
   - scale = (int) (Z_LVAL_PP(scale_param)0)
  ? 0:Z_LVAL_PP(scale_param);
   + scale = (int) (Z_LVAL_PP(scale_param) 
  0) ? 0 : Z_LVAL_PP(scale_param);
 break;
 default:
 WRONG_PARAM_COUNT;
   @@ -283,7 +287,7 @@
 WRONG_PARAM_COUNT;
 }
 convert_to_long_ex(scale_param);
   - scale = (int) (Z_LVAL_PP(scale_param)0)
  ? 0:Z_LVAL_PP(scale_param);
   + scale = (int) (Z_LVAL_PP(scale_param) 
  0) ? 0 : Z_LVAL_PP(scale_param);
 break;
 default:
 WRONG_PARAM_COUNT;
   @@ -296,7 +300,7 @@
 bc_init_num(result TSRMLS_CC);
 php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
 php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
   - switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
   + switch (bc_divide(first, second, result, scale TSRMLS_CC)) {
 case 0: /* OK */
 if (result-n_scale  scale) {
 result-n_scale = scale;
   @@ -411,7 +415,7 @@
 WRONG_PARAM_COUNT;
 }
 convert_to_long_ex(scale_param);
   - scale = (int) (Z_LVAL_PP(scale_param)0)
  ? 0:Z_LVAL_PP(scale_param);
   + scale = (int) (Z_LVAL_PP(scale_param) 
  0) ? 0 : Z_LVAL_PP(scale_param);
 break;
 default:
 WRONG_PARAM_COUNT;
   @@ -457,7 +461,7 @@
 WRONG_PARAM_COUNT;
 }
 convert_to_long_ex(scale_param);
   - scale = 

Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Derick Rethans
On Wed, 2 Apr 2003, Rasmus Lerdorf wrote:

 There was nothing wrong with the indentation.  He changed ab to a  b and
 minor things like that.  That's just cvs noise.

But it's still coding style :) Also, this is not noise IMO:

   - if(bc_precision0) bc_precision=0;
   +
   + if (bc_precision  0) {
   + bc_precision = 0;
   + }

regards,
Derick

-- 
my other box is your windows PC
-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Rasmus Lerdorf
On Thu, 3 Apr 2003, Derick Rethans wrote:

 On Wed, 2 Apr 2003, Rasmus Lerdorf wrote:

  There was nothing wrong with the indentation.  He changed ab to a  b and
  minor things like that.  That's just cvs noise.

 But it's still coding style :)

Do a grep through the code.  There are literally thousands of instances
where there is no space between a variable and an operator.  Although, by
pointing that out someone is likely to go through and fix these and thus
making the lives of anybody who rely heavily on cvs diffs a living hell.

Also, this is not noise IMO:

- if(bc_precision0) bc_precision=0;
+
+ if (bc_precision  0) {
+ bc_precision = 0;
+ }

Well, perhaps.  I certainly agree that:

   if(bc_precision0)
  bc_precision=0;

is bad because it is easy for someone to get the wrong idea and add a
second expression and think it would be covered by the condition.  That
argument is pretty weak for the single line case.

-R

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-02 Thread Jon Parise
On Wed, Apr 02, 2003 at 11:48:55PM -0800, Rasmus Lerdorf wrote:

 Also, this is not noise IMO:
 
 - if(bc_precision0) bc_precision=0;
 +
 + if (bc_precision  0) {
 + bc_precision = 0;
 + }
 
 Well, perhaps.  I certainly agree that:
 
if(bc_precision0)
   bc_precision=0;
 
 is bad because it is easy for someone to get the wrong idea and add a
 second expression and think it would be covered by the condition.  That
 argument is pretty weak for the single line case.

I would argue that adding the braces in the initial commit makes
things more consistent and reduces future diffs should an additional
statement be added.

Regardless, I think the ideal answer is for everyone to just follow
the same standard from the beginning.  If we all did that, there would
be no reason for style- or whitespace-related commits.

-- 
Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-03-19 Thread Jani Taskinen
sniper  Wed Mar 19 19:22:57 2003 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  WS  CS fixes
  Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.51 php4/ext/bcmath/bcmath.c:1.52
--- php4/ext/bcmath/bcmath.c:1.51   Thu Feb  6 17:18:41 2003
+++ php4/ext/bcmath/bcmath.cWed Mar 19 19:22:57 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.51 2003/02/06 22:18:41 pollita Exp $ */
+/* $Id: bcmath.c,v 1.52 2003/03/20 00:22:57 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -94,8 +94,8 @@
 
 PHP_RINIT_FUNCTION(bcmath)
 {
-   if (cfg_get_long(bcmath.scale, bc_precision)==FAILURE) {
-   bc_precision=0;
+   if (cfg_get_long(bcmath.scale, bc_precision) == FAILURE) {
+   bc_precision = 0;
}

bc_init_numbers(TSRMLS_C);
@@ -130,20 +130,20 @@
Returns the sum of two arbitrary precision numbers */
 PHP_FUNCTION(bcadd)
 {
-   pval **left, **right, **scale_param;
+   zval **left, **right, **scale_param;
bc_num first, second, result;
-   int scale=bc_precision;
+   int scale = bc_precision;
 
switch (ZEND_NUM_ARGS()) {
case 2:
if (zend_get_parameters_ex(2, left, right) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
+   WRONG_PARAM_COUNT;
+   }
break;
case 3:
if (zend_get_parameters_ex(3, left, right, 
scale_param) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
+   WRONG_PARAM_COUNT;
+   }
convert_to_long_ex(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
@@ -159,8 +159,9 @@
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_add (first, second, result, scale);
-   if (result-n_scale  scale)
+   if (result-n_scale  scale) {
result-n_scale = scale;
+   }
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -175,20 +176,20 @@
Returns the difference between two arbitrary precision numbers */
 PHP_FUNCTION(bcsub)
 {
-   pval **left, **right, **scale_param;
+   zval **left, **right, **scale_param;
bc_num first, second, result;
-   int scale=bc_precision;
+   int scale = bc_precision;
 
switch (ZEND_NUM_ARGS()) {
case 2:
if (zend_get_parameters_ex(2, left, right) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
+   WRONG_PARAM_COUNT;
+   }
break;
case 3:
if (zend_get_parameters_ex(3, left, right, 
scale_param) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
+   WRONG_PARAM_COUNT;
+   }
convert_to_long_ex(scale_param);
scale = (int) Z_LVAL_PP(scale_param);
break;
@@ -204,8 +205,9 @@
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_sub (first, second, result, scale);
-   if (result-n_scale  scale)
+   if (result-n_scale  scale) {
result-n_scale = scale;
+   }
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -220,20 +222,20 @@
Returns the multiplication of two arbitrary precision numbers */
 PHP_FUNCTION(bcmul)
 {
-   pval **left, **right, **scale_param;
+   zval **left, **right, **scale_param;
bc_num first, second, result;
-   int scale=bc_precision;
+   int scale = bc_precision;
 
switch (ZEND_NUM_ARGS()) {
case 2:
if (zend_get_parameters_ex(2, left, right) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
+   WRONG_PARAM_COUNT;
+   }
break;
case 3:
if (zend_get_parameters_ex(3, left, right, 
scale_param) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   

[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-02-06 Thread Sara Golemon
pollita Thu Feb  6 17:18:41 2003 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  bc_raise() can return a scale lower than that passed into it.  While most other 
bcmath calls won't, it's safest to do a quick check that we're only
  reducing n_scale, not increasing it.
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.50 php4/ext/bcmath/bcmath.c:1.51
--- php4/ext/bcmath/bcmath.c:1.50   Tue Feb  4 16:07:40 2003
+++ php4/ext/bcmath/bcmath.cThu Feb  6 17:18:41 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.50 2003/02/04 21:07:40 andi Exp $ */
+/* $Id: bcmath.c,v 1.51 2003/02/06 22:18:41 pollita Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -159,7 +159,8 @@
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_add (first, second, result, scale);
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -203,7 +204,8 @@
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_sub (first, second, result, scale);
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -247,7 +249,8 @@
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_multiply (first, second, result, scale TSRMLS_CC);
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -292,7 +295,8 @@
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
case 0: /* OK */
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -370,7 +374,8 @@
php_str2num(second, right TSRMLS_CC);
php_str2num(mod, modulous TSRMLS_CC);
bc_raisemod(first, second, mod, result, scale TSRMLS_CC);
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -415,7 +420,8 @@
php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_raise (first, second, result, scale TSRMLS_CC);
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -455,7 +461,8 @@
bc_init_num(result TSRMLS_CC);
php_str2num(result, Z_STRVAL_PP(left) TSRMLS_CC);
if (bc_sqrt (result, scale TSRMLS_CC) != 0) {
-   result-n_scale = scale;
+   if (result-n_scale  scale)
+   result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-02-04 Thread Marcus Boerger
helly   Tue Feb  4 16:01:55 2003 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  fix ZTS build
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.48 php4/ext/bcmath/bcmath.c:1.49
--- php4/ext/bcmath/bcmath.c:1.48   Tue Feb  4 14:03:30 2003
+++ php4/ext/bcmath/bcmath.cTue Feb  4 16:01:54 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.48 2003/02/04 19:03:30 pollita Exp $ */
+/* $Id: bcmath.c,v 1.49 2003/02/04 21:01:54 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -113,7 +113,7 @@
 
 /* {{{ php_str2num
Convert to bc_num detecting scale */
-static void php_str2num(bc_num *num, char *str) {
+static void php_str2num(bc_num *num, char *str TSRMLS_DC) {
char *p;
 
if (!(p = strchr(str, '.'))) {
@@ -155,8 +155,8 @@
bc_init_num(first TSRMLS_CC);
bc_init_num(second TSRMLS_CC);
bc_init_num(result TSRMLS_CC);
-   php_str2num(first, Z_STRVAL_PP(left));
-   php_str2num(second, Z_STRVAL_PP(right));
+   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
+   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_add (first, second, result, scale);
result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -199,8 +199,8 @@
bc_init_num(first TSRMLS_CC);
bc_init_num(second TSRMLS_CC);
bc_init_num(result TSRMLS_CC);
-   php_str2num(first, Z_STRVAL_PP(left));
-   php_str2num(second, Z_STRVAL_PP(right));
+   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
+   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_sub (first, second, result, scale);
result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -243,8 +243,8 @@
bc_init_num(first TSRMLS_CC);
bc_init_num(second TSRMLS_CC);
bc_init_num(result TSRMLS_CC);
-   php_str2num(first, Z_STRVAL_PP(left));
-   php_str2num(second, Z_STRVAL_PP(right));
+   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
+   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_multiply (first, second, result, scale TSRMLS_CC);
result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -287,8 +287,8 @@
bc_init_num(first TSRMLS_CC);
bc_init_num(second TSRMLS_CC);
bc_init_num(result TSRMLS_CC);
-   php_str2num(first, Z_STRVAL_PP(left));
-   php_str2num(second, Z_STRVAL_PP(right));
+   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
+   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
switch (bc_divide (first, second, result, scale TSRMLS_CC)) {
case 0: /* OK */
result-n_scale = scale;
@@ -365,9 +365,9 @@
bc_init_num(second TSRMLS_CC);
bc_init_num(mod TSRMLS_CC);
bc_init_num(result TSRMLS_CC);
-   php_str2num(first, left);
-   php_str2num(second, right);
-   php_str2num(mod, modulous);
+   php_str2num(first, left TSRMLS_CC);
+   php_str2num(second, right TSRMLS_CC);
+   php_str2num(mod, modulous TSRMLS_CC);
bc_raisemod(first, second, mod, result, scale TSRMLS_CC);
result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -411,8 +411,8 @@
bc_init_num(first TSRMLS_CC);
bc_init_num(second TSRMLS_CC);
bc_init_num(result TSRMLS_CC);
-   php_str2num(first, Z_STRVAL_PP(left));
-   php_str2num(second, Z_STRVAL_PP(right));
+   php_str2num(first, Z_STRVAL_PP(left) TSRMLS_CC);
+   php_str2num(second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_raise (first, second, result, scale TSRMLS_CC);
result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -452,7 +452,7 @@
}
convert_to_string_ex(left);
bc_init_num(result TSRMLS_CC);
-   php_str2num(result, Z_STRVAL_PP(left));
+   php_str2num(result, Z_STRVAL_PP(left) TSRMLS_CC);
if (bc_sqrt (result, scale TSRMLS_CC) != 0) {
result-n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-02-04 Thread Andi Gutmans
andiTue Feb  4 16:07:40 2003 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  - Please follow coding standards (this isn't java :)
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.49 php4/ext/bcmath/bcmath.c:1.50
--- php4/ext/bcmath/bcmath.c:1.49   Tue Feb  4 16:01:54 2003
+++ php4/ext/bcmath/bcmath.cTue Feb  4 16:07:40 2003
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.49 2003/02/04 21:01:54 helly Exp $ */
+/* $Id: bcmath.c,v 1.50 2003/02/04 21:07:40 andi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -113,7 +113,8 @@
 
 /* {{{ php_str2num
Convert to bc_num detecting scale */
-static void php_str2num(bc_num *num, char *str TSRMLS_DC) {
+static void php_str2num(bc_num *num, char *str TSRMLS_DC)
+{
char *p;
 
if (!(p = strchr(str, '.'))) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-02-04 Thread Marcus Börger
At 22:07 04.02.2003, Andi Gutmans wrote:

andiTue Feb  4 16:07:40 2003 EDT

  Modified files:
/php4/ext/bcmathbcmath.c
  Log:
  - Please follow coding standards (this isn't java :)




I only corrected this...


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-02-04 Thread Andi Gutmans
At 10:13 PM 2/4/2003 +0100, Marcus Börger wrote:

At 22:07 04.02.2003, Andi Gutmans wrote:

andiTue Feb  4 16:07:40 2003 EDT

  Modified files:
/php4/ext/bcmathbcmath.c
  Log:
  - Please follow coding standards (this isn't java :)



I only corrected this...


I know. It wasn't meant for you. Anyway it's no big deal, see smiley.

Andi


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c php_bcmath.h

2002-12-10 Thread Sara Golemon
pollita Tue Dec 10 14:04:29 2002 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c php_bcmath.h 
  Log:
  Added support for libbcmath's bc_raisemod function as bc_powmod()
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.43 php4/ext/bcmath/bcmath.c:1.44
--- php4/ext/bcmath/bcmath.c:1.43   Thu Dec  5 16:51:45 2002
+++ php4/ext/bcmath/bcmath.cTue Dec 10 14:04:27 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.43 2002/12/05 21:51:45 helly Exp $ */
+/* $Id: bcmath.c,v 1.44 2002/12/10 19:04:27 pollita Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -42,6 +42,7 @@
PHP_FE(bcsqrt, 
 NULL)
PHP_FE(bcscale,
 NULL)
PHP_FE(bccomp, 
 NULL)
+   PHP_FE(bc_powmod,  
+ NULL)
{NULL, NULL, NULL}
 };
 
@@ -324,6 +325,38 @@
}
bc_free_num(first);
bc_free_num(second);
+   bc_free_num(result);
+   return;
+}
+/* }}} */
+
+/* {{{ proto string bc_powmod(string x, string y, string mod [, int scale])
+   Returns the value of an arbitrary precision number raised to the power of another 
+reduced by a modulous */
+PHP_FUNCTION(bc_powmod)
+{
+   char *left, *right, *modulous;
+   int left_len, right_len, modulous_len;
+   bc_num first, second, mod, result;
+   int scale=bc_precision;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_C, sss|l, left, left_len, 
+right, right_len, modulous, modulous_len, scale) == FAILURE) {
+   WRONG_PARAM_COUNT;
+   }
+
+   bc_init_num(first TSRMLS_CC);
+   bc_init_num(second TSRMLS_CC);
+   bc_init_num(mod TSRMLS_CC);
+   bc_init_num(result TSRMLS_CC);
+   bc_str2num(first, left, scale TSRMLS_CC);
+   bc_str2num(second, right, scale TSRMLS_CC);
+   bc_str2num(mod, modulous, scale TSRMLS_CC);
+   bc_raisemod(first, second, mod, result, scale TSRMLS_CC);
+   Z_STRVAL_P(return_value) = bc_num2str(result);
+   Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
+   Z_TYPE_P(return_value) = IS_STRING;
+   bc_free_num(first);
+   bc_free_num(second);
+   bc_free_num(mod);
bc_free_num(result);
return;
 }
Index: php4/ext/bcmath/php_bcmath.h
diff -u php4/ext/bcmath/php_bcmath.h:1.12 php4/ext/bcmath/php_bcmath.h:1.13
--- php4/ext/bcmath/php_bcmath.h:1.12   Fri Nov 22 04:25:28 2002
+++ php4/ext/bcmath/php_bcmath.hTue Dec 10 14:04:27 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: php_bcmath.h,v 1.12 2002/11/22 09:25:28 sander Exp $ */
+/* $Id: php_bcmath.h,v 1.13 2002/12/10 19:04:27 pollita Exp $ */
 
 #ifndef PHP_BCMATH_H
 #define PHP_BCMATH_H
@@ -60,6 +60,7 @@
 PHP_FUNCTION(bcsqrt);
 PHP_FUNCTION(bccomp);
 PHP_FUNCTION(bcscale);
+PHP_FUNCTION(bc_powmod);
 
 #else
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2002-12-10 Thread Frank M. Kromann
fmk Tue Dec 10 14:28:04 2002 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
  Log:
  Fixing ZTS Build
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.44 php4/ext/bcmath/bcmath.c:1.45
--- php4/ext/bcmath/bcmath.c:1.44   Tue Dec 10 14:04:27 2002
+++ php4/ext/bcmath/bcmath.cTue Dec 10 14:28:04 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.44 2002/12/10 19:04:27 pollita Exp $ */
+/* $Id: bcmath.c,v 1.45 2002/12/10 19:28:04 fmk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -339,7 +339,7 @@
bc_num first, second, mod, result;
int scale=bc_precision;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_C, sss|l, left, left_len, 
right, right_len, modulous, modulous_len, scale) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sss|l, left, 
+left_len, right, right_len, modulous, modulous_len, scale) == FAILURE) {
WRONG_PARAM_COUNT;
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c php_bcmath.h /ext/bcmath/libbcmath/src bcmath.h debug.c div.c divmod.c init.c output.c raise.c raisemod.c recmul.c sqrt.c str2num.c zero.c

2002-11-22 Thread Sander Roobol
sander  Fri Nov 22 04:25:29 2002 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c php_bcmath.h 
/php4/ext/bcmath/libbcmath/src  bcmath.h debug.c div.c divmod.c 
init.c output.c raise.c raisemod.c 
recmul.c sqrt.c str2num.c zero.c 
  Log:
  Made bcmath extension thread safe.
  @Made bcmath extension thread safe. (Sander)
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.41 php4/ext/bcmath/bcmath.c:1.42
--- php4/ext/bcmath/bcmath.c:1.41   Wed Nov 20 15:03:00 2002
+++ php4/ext/bcmath/bcmath.cFri Nov 22 04:25:28 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.41 2002/11/20 20:03:00 andi Exp $ */
+/* $Id: bcmath.c,v 1.42 2002/11/22 09:25:28 sander Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,6 +30,8 @@
 #include php_bcmath.h
 #include libbcmath/src/bcmath.h
 
+ZEND_DECLARE_MODULE_GLOBALS(bcmath);
+
 function_entry bcmath_functions[] = {
PHP_FE(bcadd,  
 NULL)
PHP_FE(bcsub,  
 NULL)
@@ -47,7 +49,11 @@
STANDARD_MODULE_HEADER,
bcmath,
bcmath_functions,
+#if ZTS
+   PHP_MODULE_STARTUP_N(bcmath),
+#else
NULL,
+#endif
NULL,
PHP_RINIT(bcmath),
PHP_RSHUTDOWN(bcmath),
@@ -64,32 +70,22 @@
 static long bc_precision;
 #endif
 
-/* Storage used for special numbers. */
-extern bc_num _zero_;
-extern bc_num _one_;
-extern bc_num _two_;
-
-
-/* Make a copy of a number!  Just increments the reference count! */
-bc_num copy_num (bc_num num)
+#if ZTS
+PHP_MODULE_STARTUP_D(bcmath)
 {
-  num-n_refs++;
-  return num;
-}
+   zend_bcmath_globals *bcmath_globals;
 
-
-/* Initialize a number NUM by making it a copy of zero. */
-void init_num (bc_num *num)
-{
-   *num = copy_num (_zero_);
+   ts_allocate_id(bcmath_globals_id, sizeof(zend_bcmath_globals), NULL, NULL);
+   bcmath_globals = ts_resource(bcmath_globals_id);
+   return SUCCESS;
 }
-
+#endif
 
 PHP_RSHUTDOWN_FUNCTION(bcmath)
 {
-   bc_free_num(_zero_);
-   bc_free_num(_one_);
-   bc_free_num(_two_);
+   bc_free_num(BCG(_zero_));
+   bc_free_num(BCG(_one_));
+   bc_free_num(BCG(_two_));
 
return SUCCESS;
 }
@@ -101,7 +97,7 @@
bc_precision=0;
}

-   bc_init_numbers();
+   bc_init_numbers(TSRMLS_C);

return SUCCESS;
 }
@@ -141,11 +137,11 @@
}
convert_to_string_ex(left);
convert_to_string_ex(right);
-   bc_init_num(first);
-   bc_init_num(second);
-   bc_init_num(result);
-   bc_str2num(first, Z_STRVAL_PP(left), scale);
-   bc_str2num(second, Z_STRVAL_PP(right), scale);
+   bc_init_num(first TSRMLS_CC);
+   bc_init_num(second TSRMLS_CC);
+   bc_init_num(result TSRMLS_CC);
+   bc_str2num(first, Z_STRVAL_PP(left), scale TSRMLS_CC);
+   bc_str2num(second, Z_STRVAL_PP(right), scale TSRMLS_CC);
bc_add (first, second, result, scale);
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
@@ -184,11 +180,11 @@
}
convert_to_string_ex(left);
convert_to_string_ex(right);
-   bc_init_num(first);
-   bc_init_num(second);
-   bc_init_num(result);
-   bc_str2num(first, Z_STRVAL_PP(left), scale);
-   bc_str2num(second, Z_STRVAL_PP(right), scale);
+   bc_init_num(first TSRMLS_CC);
+   bc_init_num(second TSRMLS_CC);
+   bc_init_num(result TSRMLS_CC);
+   bc_str2num(first, Z_STRVAL_PP(left), scale TSRMLS_CC);
+   bc_str2num(second, Z_STRVAL_PP(right), scale TSRMLS_CC);
bc_sub (first, second, result, scale);
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
@@ -227,12 +223,12 @@
}
convert_to_string_ex(left);
convert_to_string_ex(right);
-   bc_init_num(first);
-   bc_init_num(second);
-   bc_init_num(result);
-   bc_str2num(first, Z_STRVAL_PP(left), scale);
-   bc_str2num(second, Z_STRVAL_PP(right), scale);
-   bc_multiply (first, second, result, scale);
+   bc_init_num(first TSRMLS_CC);
+   bc_init_num(second TSRMLS_CC);
+   bc_init_num(result TSRMLS_CC);
+   bc_str2num(first, Z_STRVAL_PP(left), scale TSRMLS_CC);
+   bc_str2num(second, Z_STRVAL_PP(right), scale TSRMLS_CC);
+   bc_multiply (first, second, result, scale TSRMLS_CC);
Z_STRVAL_P(return_value) = bc_num2str(result);
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
Z_TYPE_P(return_value) = IS_STRING;
@@ -270,12 +266,12 @@
}
convert_to_string_ex(left);
convert_to_string_ex(right);
- 

[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c /ext/bcmath/libbcmath/src bcmath.h init.c output.c raise.c raisemod.c recmul.c sqrt.c str2num.c zero.c

2002-11-20 Thread Andi Gutmans
andiWed Nov 20 14:48:13 2002 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
/php4/ext/bcmath/libbcmath/src  bcmath.h init.c output.c raise.c 
raisemod.c recmul.c sqrt.c str2num.c 
zero.c 
  Log:
  - Intermediate commit which works on making bcmath thread-safe.
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.39 php4/ext/bcmath/bcmath.c:1.40
--- php4/ext/bcmath/bcmath.c:1.39   Sun Aug 18 00:33:10 2002
+++ php4/ext/bcmath/bcmath.cWed Nov 20 14:48:12 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.39 2002/08/18 04:33:10 kalowsky Exp $ */
+/* $Id: bcmath.c,v 1.40 2002/11/20 19:48:12 andi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -65,9 +65,9 @@
 #endif
 
 /* Storage used for special numbers. */
-extern bc_num _zero_;
-extern bc_num _one_;
-extern bc_num _two_;
+extern bc_num BCG(_zero_);
+extern bc_num BCG(_one_);
+extern bc_num BCG(_two_);
 
 
 /* Make a copy of a number!  Just increments the reference count! */
@@ -81,15 +81,15 @@
 /* Initialize a number NUM by making it a copy of zero. */
 void init_num (bc_num *num)
 {
-   *num = copy_num (_zero_);
+   *num = copy_num (BCG(_zero_));
 }
 
 
 PHP_RSHUTDOWN_FUNCTION(bcmath)
 {
-   bc_free_num(_zero_);
-   bc_free_num(_one_);
-   bc_free_num(_two_);
+   bc_free_num(BCG(_zero_));
+   bc_free_num(BCG(_one_));
+   bc_free_num(BCG(_two_));
 
return SUCCESS;
 }
Index: php4/ext/bcmath/libbcmath/src/bcmath.h
diff -u php4/ext/bcmath/libbcmath/src/bcmath.h:1.2 
php4/ext/bcmath/libbcmath/src/bcmath.h:1.3
--- php4/ext/bcmath/libbcmath/src/bcmath.h:1.2  Sat Aug 11 12:38:18 2001
+++ php4/ext/bcmath/libbcmath/src/bcmath.h  Wed Nov 20 14:48:12 2002
@@ -80,11 +80,11 @@
 #define LONG_MAX 0x7ff
 #endif
 
-
+#define BCG(s) s##a
 /* Global numbers. */
-extern bc_num _zero_;
-extern bc_num _one_;
-extern bc_num _two_;
+extern bc_num BCG(_zero_);
+extern bc_num BCG(_one_);
+extern bc_num BCG(_two_);
 
 
 /* Function Prototypes */
Index: php4/ext/bcmath/libbcmath/src/init.c
diff -u php4/ext/bcmath/libbcmath/src/init.c:1.1 
php4/ext/bcmath/libbcmath/src/init.c:1.2
--- php4/ext/bcmath/libbcmath/src/init.c:1.1Wed Nov 22 15:20:02 2000
+++ php4/ext/bcmath/libbcmath/src/init.cWed Nov 20 14:48:12 2002
@@ -39,9 +39,9 @@
 #include private.h
 
 /* Storage used for special numbers. */
-bc_num _zero_;
-bc_num _one_;
-bc_num _two_;
+bc_num BCG(_zero_);
+bc_num BCG(_one_);
+bc_num BCG(_two_);
 
  bc_num _bc_Free_list = NULL;
 
@@ -105,11 +105,11 @@
 void
 bc_init_numbers ()
 {
-  _zero_ = bc_new_num (1,0);
-  _one_  = bc_new_num (1,0);
-  _one_-n_value[0] = 1;
-  _two_  = bc_new_num (1,0);
-  _two_-n_value[0] = 2;
+  BCG(_zero_) = bc_new_num (1,0);
+  BCG(_one_)  = bc_new_num (1,0);
+  BCG(_one_)-n_value[0] = 1;
+  BCG(_two_)  = bc_new_num (1,0);
+  BCG(_two_)-n_value[0] = 2;
 }
 
 
@@ -130,6 +130,6 @@
 bc_init_num (num)
  bc_num *num;
 {
-  *num = bc_copy_num (_zero_);
+  *num = bc_copy_num (BCG(_zero_));
 }
 
Index: php4/ext/bcmath/libbcmath/src/output.c
diff -u php4/ext/bcmath/libbcmath/src/output.c:1.2 
php4/ext/bcmath/libbcmath/src/output.c:1.3
--- php4/ext/bcmath/libbcmath/src/output.c:1.2  Sun Nov 26 04:34:01 2000
+++ php4/ext/bcmath/libbcmath/src/output.c  Wed Nov 20 14:48:12 2002
@@ -138,7 +138,7 @@
/* The number is some other base. */
digits = NULL;
bc_init_num (int_part);
-   bc_divide (num, _one_, int_part, 0);
+   bc_divide (num, BCG(_one_), int_part, 0);
bc_init_num (frac_part);
bc_init_num (cur_dig);
bc_init_num (base);
@@ -185,7 +185,7 @@
  {
(*out_char) ('.');
pre_space = 0;
-   t_num = bc_copy_num (_one_);
+   t_num = bc_copy_num (BCG(_one_));
while (t_num-n_len = num-n_scale) {
  bc_multiply (frac_part, base, frac_part, num-n_scale);
  fdigit = bc_num2long (frac_part);
Index: php4/ext/bcmath/libbcmath/src/raise.c
diff -u php4/ext/bcmath/libbcmath/src/raise.c:1.1 
php4/ext/bcmath/libbcmath/src/raise.c:1.2
--- php4/ext/bcmath/libbcmath/src/raise.c:1.1   Wed Nov 22 15:20:02 2000
+++ php4/ext/bcmath/libbcmath/src/raise.c   Wed Nov 20 14:48:12 2002
@@ -66,7 +66,7 @@
if (exponent == 0)
  {
bc_free_num (result);
-   *result = bc_copy_num (_one_);
+   *result = bc_copy_num (BCG(_one_));
return;
  }
 
@@ -111,7 +111,7 @@
/* Assign the value. */
if (neg)
  {
-   bc_divide (_one_, temp, result, rscale);
+   bc_divide (BCG(_one_), temp, result, rscale);
bc_free_num (temp);
  }
else
Index: php4/ext/bcmath/libbcmath/src/raisemod.c
diff -u php4/ext/bcmath/libbcmath/src/raisemod.c:1.1 
php4/ext/bcmath/libbcmath/src/raisemod.c:1.2
--- 

[PHP-CVS] cvs: php4 /ext/bcmath bcmath.c /ext/bcmath/libbcmath/src bcmath.h init.c output.c raise.c raisemod.c recmul.c sqrt.c str2num.c zero.c

2002-11-20 Thread Andi Gutmans
andiWed Nov 20 15:03:02 2002 EDT

  Modified files:  
/php4/ext/bcmathbcmath.c 
/php4/ext/bcmath/libbcmath/src  bcmath.h init.c output.c raise.c 
raisemod.c recmul.c sqrt.c str2num.c 
zero.c 
  Log:
  - Revert previous patch
  
  
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.40 php4/ext/bcmath/bcmath.c:1.41
--- php4/ext/bcmath/bcmath.c:1.40   Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/bcmath.cWed Nov 20 15:03:00 2002
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bcmath.c,v 1.40 2002/11/20 19:48:12 andi Exp $ */
+/* $Id: bcmath.c,v 1.41 2002/11/20 20:03:00 andi Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -65,9 +65,9 @@
 #endif
 
 /* Storage used for special numbers. */
-extern bc_num BCG(_zero_);
-extern bc_num BCG(_one_);
-extern bc_num BCG(_two_);
+extern bc_num _zero_;
+extern bc_num _one_;
+extern bc_num _two_;
 
 
 /* Make a copy of a number!  Just increments the reference count! */
@@ -81,15 +81,15 @@
 /* Initialize a number NUM by making it a copy of zero. */
 void init_num (bc_num *num)
 {
-   *num = copy_num (BCG(_zero_));
+   *num = copy_num (_zero_);
 }
 
 
 PHP_RSHUTDOWN_FUNCTION(bcmath)
 {
-   bc_free_num(BCG(_zero_));
-   bc_free_num(BCG(_one_));
-   bc_free_num(BCG(_two_));
+   bc_free_num(_zero_);
+   bc_free_num(_one_);
+   bc_free_num(_two_);
 
return SUCCESS;
 }
Index: php4/ext/bcmath/libbcmath/src/bcmath.h
diff -u php4/ext/bcmath/libbcmath/src/bcmath.h:1.3 
php4/ext/bcmath/libbcmath/src/bcmath.h:1.4
--- php4/ext/bcmath/libbcmath/src/bcmath.h:1.3  Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/bcmath.h  Wed Nov 20 15:03:01 2002
@@ -80,11 +80,11 @@
 #define LONG_MAX 0x7ff
 #endif
 
-#define BCG(s) s##a
+
 /* Global numbers. */
-extern bc_num BCG(_zero_);
-extern bc_num BCG(_one_);
-extern bc_num BCG(_two_);
+extern bc_num _zero_;
+extern bc_num _one_;
+extern bc_num _two_;
 
 
 /* Function Prototypes */
Index: php4/ext/bcmath/libbcmath/src/init.c
diff -u php4/ext/bcmath/libbcmath/src/init.c:1.2 
php4/ext/bcmath/libbcmath/src/init.c:1.3
--- php4/ext/bcmath/libbcmath/src/init.c:1.2Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/init.cWed Nov 20 15:03:01 2002
@@ -39,9 +39,9 @@
 #include private.h
 
 /* Storage used for special numbers. */
-bc_num BCG(_zero_);
-bc_num BCG(_one_);
-bc_num BCG(_two_);
+bc_num _zero_;
+bc_num _one_;
+bc_num _two_;
 
  bc_num _bc_Free_list = NULL;
 
@@ -105,11 +105,11 @@
 void
 bc_init_numbers ()
 {
-  BCG(_zero_) = bc_new_num (1,0);
-  BCG(_one_)  = bc_new_num (1,0);
-  BCG(_one_)-n_value[0] = 1;
-  BCG(_two_)  = bc_new_num (1,0);
-  BCG(_two_)-n_value[0] = 2;
+  _zero_ = bc_new_num (1,0);
+  _one_  = bc_new_num (1,0);
+  _one_-n_value[0] = 1;
+  _two_  = bc_new_num (1,0);
+  _two_-n_value[0] = 2;
 }
 
 
@@ -130,6 +130,6 @@
 bc_init_num (num)
  bc_num *num;
 {
-  *num = bc_copy_num (BCG(_zero_));
+  *num = bc_copy_num (_zero_);
 }
 
Index: php4/ext/bcmath/libbcmath/src/output.c
diff -u php4/ext/bcmath/libbcmath/src/output.c:1.3 
php4/ext/bcmath/libbcmath/src/output.c:1.4
--- php4/ext/bcmath/libbcmath/src/output.c:1.3  Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/output.c  Wed Nov 20 15:03:01 2002
@@ -138,7 +138,7 @@
/* The number is some other base. */
digits = NULL;
bc_init_num (int_part);
-   bc_divide (num, BCG(_one_), int_part, 0);
+   bc_divide (num, _one_, int_part, 0);
bc_init_num (frac_part);
bc_init_num (cur_dig);
bc_init_num (base);
@@ -185,7 +185,7 @@
  {
(*out_char) ('.');
pre_space = 0;
-   t_num = bc_copy_num (BCG(_one_));
+   t_num = bc_copy_num (_one_);
while (t_num-n_len = num-n_scale) {
  bc_multiply (frac_part, base, frac_part, num-n_scale);
  fdigit = bc_num2long (frac_part);
Index: php4/ext/bcmath/libbcmath/src/raise.c
diff -u php4/ext/bcmath/libbcmath/src/raise.c:1.2 
php4/ext/bcmath/libbcmath/src/raise.c:1.3
--- php4/ext/bcmath/libbcmath/src/raise.c:1.2   Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/raise.c   Wed Nov 20 15:03:01 2002
@@ -66,7 +66,7 @@
if (exponent == 0)
  {
bc_free_num (result);
-   *result = bc_copy_num (BCG(_one_));
+   *result = bc_copy_num (_one_);
return;
  }
 
@@ -111,7 +111,7 @@
/* Assign the value. */
if (neg)
  {
-   bc_divide (BCG(_one_), temp, result, rscale);
+   bc_divide (_one_, temp, result, rscale);
bc_free_num (temp);
  }
else
Index: php4/ext/bcmath/libbcmath/src/raisemod.c
diff -u php4/ext/bcmath/libbcmath/src/raisemod.c:1.2 
php4/ext/bcmath/libbcmath/src/raisemod.c:1.3
--- php4/ext/bcmath/libbcmath/src/raisemod.c:1.2Wed Nov 20 14:48:12 2002
+++