@@ -555,15 +555,12 @@ ZEND_API zend_opt_bool ZEND_FASTCALL zend_flf_parse_arg_bool_slow(const zval *ar
555
555
556
556
ZEND_API zend_opt_long ZEND_FASTCALL zend_parse_arg_long_weak (const zval * arg , uint32_t arg_num ) /* {{{ */
557
557
{
558
- zend_opt_long result ;
559
- result .has_value = false;
560
-
561
558
if (EXPECTED (Z_TYPE_P (arg ) == IS_DOUBLE )) {
562
559
if (UNEXPECTED (zend_isnan (Z_DVAL_P (arg )))) {
563
- return result ;
560
+ goto fail ;
564
561
}
565
562
if (UNEXPECTED (!ZEND_DOUBLE_FITS_LONG (Z_DVAL_P (arg )))) {
566
- return result ;
563
+ goto fail ;
567
564
} else {
568
565
zend_long lval = zend_dval_to_lval (Z_DVAL_P (arg ));
569
566
if (UNEXPECTED (!zend_is_long_compatible (Z_DVAL_P (arg ), lval ))) {
@@ -573,23 +570,23 @@ ZEND_API zend_opt_long ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, u
573
570
zend_incompatible_double_to_long_error (Z_DVAL_P (arg ));
574
571
}
575
572
if (UNEXPECTED (EG (exception ))) {
576
- return result ;
573
+ goto fail ;
577
574
}
578
575
}
579
- result . value = lval ;
576
+ return ( zend_opt_long ){ lval , true} ;
580
577
}
581
578
} else if (EXPECTED (Z_TYPE_P (arg ) == IS_STRING )) {
582
579
double d ;
583
580
uint8_t type ;
581
+ zend_long lval ;
584
582
585
- if (UNEXPECTED ((type = is_numeric_str_function (Z_STR_P (arg ), & result . value , & d )) != IS_LONG )) {
583
+ if (UNEXPECTED ((type = is_numeric_str_function (Z_STR_P (arg ), & lval , & d )) != IS_LONG )) {
586
584
if (EXPECTED (type != 0 )) {
587
- zend_long lval ;
588
585
if (UNEXPECTED (zend_isnan (d ))) {
589
- return result ;
586
+ goto fail ;
590
587
}
591
588
if (UNEXPECTED (!ZEND_DOUBLE_FITS_LONG (d ))) {
592
- return result ;
589
+ goto fail ;
593
590
}
594
591
595
592
lval = zend_dval_to_lval (d );
@@ -601,28 +598,27 @@ ZEND_API zend_opt_long ZEND_FASTCALL zend_parse_arg_long_weak(const zval *arg, u
601
598
zend_incompatible_string_to_long_error (Z_STR_P (arg ));
602
599
}
603
600
if (UNEXPECTED (EG (exception ))) {
604
- return result ;
601
+ goto fail ;
605
602
}
606
603
}
607
- result .value = lval ;
608
- } else {
609
- return result ;
610
604
}
605
+ return (zend_opt_long ){lval , true};
611
606
}
612
607
if (UNEXPECTED (EG (exception ))) {
613
- return result ;
608
+ goto fail ;
614
609
}
615
610
} else if (EXPECTED (Z_TYPE_P (arg ) < IS_TRUE )) {
616
611
if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("int" , arg_num )) {
617
- return result ;
612
+ goto fail ;
618
613
}
619
- result . value = 0 ;
614
+ return ( zend_opt_long ){ 0 , true} ;
620
615
} else if (EXPECTED (Z_TYPE_P (arg ) == IS_TRUE )) {
621
- result .value = 1 ;
622
- } else {
623
- return result ;
616
+ return (zend_opt_long ){1 , true};
624
617
}
625
- result .has_value = true;
618
+
619
+ fail :;
620
+ zend_opt_long result ;
621
+ result .has_value = false;
626
622
return result ;
627
623
}
628
624
/* }}} */
@@ -670,24 +666,21 @@ ZEND_API zend_opt_double ZEND_FASTCALL zend_parse_arg_double_weak(const zval *ar
670
666
return (zend_opt_double ){d , true};
671
667
}
672
668
if (UNEXPECTED (EG (exception ))) {
673
- zend_opt_double result ;
674
- result .has_value = false;
675
- return result ;
669
+ goto fail ;
676
670
}
677
671
} else if (EXPECTED (Z_TYPE_P (arg ) < IS_TRUE )) {
678
672
if (UNEXPECTED (Z_TYPE_P (arg ) == IS_NULL ) && !zend_null_arg_deprecated ("float" , arg_num )) {
679
- zend_opt_double result ;
680
- result .has_value = false;
681
- return result ;
673
+ goto fail ;
682
674
}
683
675
return (zend_opt_double ){0.0 , true};
684
676
} else if (EXPECTED (Z_TYPE_P (arg ) == IS_TRUE )) {
685
677
return (zend_opt_double ){1.0 , true};
686
- } else {
687
- zend_opt_double result ;
688
- result .has_value = false;
689
- return result ;
690
678
}
679
+
680
+ fail :;
681
+ zend_opt_double result ;
682
+ result .has_value = false;
683
+ return result ;
691
684
}
692
685
/* }}} */
693
686
0 commit comments