@@ -229,13 +229,16 @@ PHP_FUNCTION(bcadd)
229
229
zend_string * left , * right ;
230
230
zend_long scale_param = 0 ;
231
231
bc_num first , second , result ;
232
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
232
+ int scale = (int )BCG (bc_precision );
233
233
234
- if (zend_parse_parameters (argc , "SS|l" , & left , & right , & scale_param ) == FAILURE ) {
235
- return ;
236
- }
234
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
235
+ Z_PARAM_STR (left )
236
+ Z_PARAM_STR (right )
237
+ Z_PARAM_OPTIONAL
238
+ Z_PARAM_LONG (scale_param )
239
+ ZEND_PARSE_PARAMETERS_END ();
237
240
238
- if (argc == 3 ) {
241
+ if (ZEND_NUM_ARGS () == 3 ) {
239
242
scale = (int ) (scale_param < 0 ? 0 : scale_param );
240
243
}
241
244
@@ -266,13 +269,16 @@ PHP_FUNCTION(bcsub)
266
269
zend_string * left , * right ;
267
270
zend_long scale_param = 0 ;
268
271
bc_num first , second , result ;
269
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
272
+ int scale = (int )BCG (bc_precision );
270
273
271
- if (zend_parse_parameters (argc , "SS|l" , & left , & right , & scale_param ) == FAILURE ) {
272
- return ;
273
- }
274
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
275
+ Z_PARAM_STR (left )
276
+ Z_PARAM_STR (right )
277
+ Z_PARAM_OPTIONAL
278
+ Z_PARAM_LONG (scale_param )
279
+ ZEND_PARSE_PARAMETERS_END ();
274
280
275
- if (argc == 3 ) {
281
+ if (ZEND_NUM_ARGS () == 3 ) {
276
282
scale = (int ) ((int )scale_param < 0 ? 0 : scale_param );
277
283
}
278
284
@@ -303,13 +309,16 @@ PHP_FUNCTION(bcmul)
303
309
zend_string * left , * right ;
304
310
zend_long scale_param = 0 ;
305
311
bc_num first , second , result ;
306
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
312
+ int scale = (int )BCG (bc_precision );
307
313
308
- if (zend_parse_parameters (argc , "SS|l" , & left , & right , & scale_param ) == FAILURE ) {
309
- return ;
310
- }
314
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
315
+ Z_PARAM_STR (left )
316
+ Z_PARAM_STR (right )
317
+ Z_PARAM_OPTIONAL
318
+ Z_PARAM_LONG (scale_param )
319
+ ZEND_PARSE_PARAMETERS_END ();
311
320
312
- if (argc == 3 ) {
321
+ if (ZEND_NUM_ARGS () == 3 ) {
313
322
scale = (int ) ((int )scale_param < 0 ? 0 : scale_param );
314
323
}
315
324
@@ -340,13 +349,16 @@ PHP_FUNCTION(bcdiv)
340
349
zend_string * left , * right ;
341
350
zend_long scale_param = 0 ;
342
351
bc_num first , second , result ;
343
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
352
+ int scale = (int )BCG (bc_precision );
344
353
345
- if (zend_parse_parameters (argc , "SS|l" , & left , & right , & scale_param ) == FAILURE ) {
346
- return ;
347
- }
354
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
355
+ Z_PARAM_STR (left )
356
+ Z_PARAM_STR (right )
357
+ Z_PARAM_OPTIONAL
358
+ Z_PARAM_LONG (scale_param )
359
+ ZEND_PARSE_PARAMETERS_END ();
348
360
349
- if (argc == 3 ) {
361
+ if (ZEND_NUM_ARGS () == 3 ) {
350
362
scale = (int ) ((int )scale_param < 0 ? 0 : scale_param );
351
363
}
352
364
@@ -383,9 +395,10 @@ PHP_FUNCTION(bcmod)
383
395
zend_string * left , * right ;
384
396
bc_num first , second , result ;
385
397
386
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "SS" , & left , & right ) == FAILURE ) {
387
- return ;
388
- }
398
+ ZEND_PARSE_PARAMETERS_START (2 , 2 )
399
+ Z_PARAM_STR (left )
400
+ Z_PARAM_STR (right )
401
+ ZEND_PARSE_PARAMETERS_END ();
389
402
390
403
bc_init_num (& first );
391
404
bc_init_num (& second );
@@ -418,9 +431,13 @@ PHP_FUNCTION(bcpowmod)
418
431
zend_long scale = BCG (bc_precision );
419
432
int scale_int ;
420
433
421
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "SSS|l" , & left , & right , & modulous , & scale ) == FAILURE ) {
422
- return ;
423
- }
434
+ ZEND_PARSE_PARAMETERS_START (3 , 4 )
435
+ Z_PARAM_STR (left )
436
+ Z_PARAM_STR (right )
437
+ Z_PARAM_STR (modulous )
438
+ Z_PARAM_OPTIONAL
439
+ Z_PARAM_LONG (scale )
440
+ ZEND_PARSE_PARAMETERS_END ();
424
441
425
442
bc_init_num (& first );
426
443
bc_init_num (& second );
@@ -457,13 +474,16 @@ PHP_FUNCTION(bcpow)
457
474
zend_string * left , * right ;
458
475
zend_long scale_param = 0 ;
459
476
bc_num first , second , result ;
460
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
477
+ int scale = (int )BCG (bc_precision );
461
478
462
- if (zend_parse_parameters (argc , "SS|l" , & left , & right , & scale_param ) == FAILURE ) {
463
- return ;
464
- }
479
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
480
+ Z_PARAM_STR (left )
481
+ Z_PARAM_STR (right )
482
+ Z_PARAM_OPTIONAL
483
+ Z_PARAM_LONG (scale_param )
484
+ ZEND_PARSE_PARAMETERS_END ();
465
485
466
- if (argc == 3 ) {
486
+ if (ZEND_NUM_ARGS () == 3 ) {
467
487
scale = (int ) ((int )scale_param < 0 ? 0 : scale_param );
468
488
}
469
489
@@ -494,13 +514,15 @@ PHP_FUNCTION(bcsqrt)
494
514
zend_string * left ;
495
515
zend_long scale_param = 0 ;
496
516
bc_num result ;
497
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
517
+ int scale = (int )BCG (bc_precision );
498
518
499
- if (zend_parse_parameters (argc , "S|l" , & left , & scale_param ) == FAILURE ) {
500
- return ;
501
- }
519
+ ZEND_PARSE_PARAMETERS_START (1 , 2 )
520
+ Z_PARAM_STR (left )
521
+ Z_PARAM_OPTIONAL
522
+ Z_PARAM_LONG (scale_param )
523
+ ZEND_PARSE_PARAMETERS_END ();
502
524
503
- if (argc == 2 ) {
525
+ if (ZEND_NUM_ARGS () == 2 ) {
504
526
scale = (int ) ((int )scale_param < 0 ? 0 : scale_param );
505
527
}
506
528
@@ -529,13 +551,16 @@ PHP_FUNCTION(bccomp)
529
551
zend_string * left , * right ;
530
552
zend_long scale_param = 0 ;
531
553
bc_num first , second ;
532
- int scale = (int )BCG (bc_precision ), argc = ZEND_NUM_ARGS () ;
554
+ int scale = (int )BCG (bc_precision );
533
555
534
- if (zend_parse_parameters (argc , "SS|l" , & left , & right , & scale_param ) == FAILURE ) {
535
- return ;
536
- }
556
+ ZEND_PARSE_PARAMETERS_START (2 , 3 )
557
+ Z_PARAM_STR (left )
558
+ Z_PARAM_STR (right )
559
+ Z_PARAM_OPTIONAL
560
+ Z_PARAM_LONG (scale_param )
561
+ ZEND_PARSE_PARAMETERS_END ();
537
562
538
- if (argc == 3 ) {
563
+ if (ZEND_NUM_ARGS () == 3 ) {
539
564
scale = (int ) ((int )scale_param < 0 ? 0 : scale_param );
540
565
}
541
566
@@ -558,9 +583,9 @@ PHP_FUNCTION(bcscale)
558
583
{
559
584
zend_long new_scale ;
560
585
561
- if ( zend_parse_parameters ( ZEND_NUM_ARGS (), "l" , & new_scale ) == FAILURE ) {
562
- return ;
563
- }
586
+ ZEND_PARSE_PARAMETERS_START ( 1 , 1 )
587
+ Z_PARAM_LONG ( new_scale )
588
+ ZEND_PARSE_PARAMETERS_END ();
564
589
565
590
BCG (bc_precision ) = ((int )new_scale < 0 ) ? 0 : new_scale ;
566
591
0 commit comments