Skip to content

Commit

Permalink
perl.h: Avoid unnecessary calls to set_numeric_standard()
Browse files Browse the repository at this point in the history
Prior to this commit, set_numeric_standard() was called unconditionally,
and it could decide if it should do anything or not.  But the variable
that indicates this is available to the caller, so by testing it, it can
avoid the call, which is most likely the case.
  • Loading branch information
khwilliamson committed Apr 29, 2021
1 parent f30479c commit afcfded
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions perl.h
Expand Up @@ -7098,14 +7098,16 @@ cannot have changed since the precalculation.
LC_NUMERIC_UNLOCK; \
} STMT_END

/* The next two macros set unconditionally. These should be rarely used, and
* only after being sure that this is what is needed */
/* The next two macros should be rarely used, and only after being sure that
* this is what is needed */
# define SET_NUMERIC_STANDARD() \
STMT_START { \
DEBUG_Lv(PerlIO_printf(Perl_debug_log, \
"%s: %d: lc_numeric standard=%d\n", \
__FILE__, __LINE__, PL_numeric_standard)); \
Perl_set_numeric_standard(aTHX); \
if (NOT_IN_NUMERIC_STANDARD_) { \
Perl_set_numeric_standard(aTHX); \
} \
DEBUG_Lv(PerlIO_printf(Perl_debug_log, \
"%s: %d: lc_numeric standard=%d\n", \
__FILE__, __LINE__, PL_numeric_standard)); \
Expand Down

0 comments on commit afcfded

Please sign in to comment.