summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-06-03 09:08:50 -0600
committerSteve Hay <steve.m.hay@googlemail.com>2017-08-23 21:21:02 +0100
commit6e35e9969781d5b6932a8fd1f2c4973b6350a845 (patch)
tree50054ffb2243674db0d2f7cdc968bdffe7e1b6f9 /perl.h
parentb632bcdee5b2a66cf1d36f758f89ef24e32a9168 (diff)
downloadperl-6e35e9969781d5b6932a8fd1f2c4973b6350a845.tar.gz
Make LOCK_LC_NUMERIC_STANDARD recursive
Same for UNLOCK_LC_NUMERIC_STANDARD. This partially fixes [perl #128207] (cherry picked from commit 42752acc4959c5b770bbc29532bf2677f4533c4e)
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/perl.h b/perl.h
index da326abc19..7c07afd6c7 100644
--- a/perl.h
+++ b/perl.h
@@ -6187,14 +6187,20 @@ expression, but with an empty argument list, like this:
_restore_LC_NUMERIC_function = &Perl_set_numeric_standard; \
}
-/* Lock to the C locale until unlock is called */
+/* Lock/unlock to the C locale until unlock is called. This needs to be
+ * recursively callable. [perl #128207] */
#define LOCK_LC_NUMERIC_STANDARD() \
(__ASSERT_(PL_numeric_standard) \
- PL_numeric_standard = 2)
-
+ PL_numeric_standard++)
#define UNLOCK_LC_NUMERIC_STANDARD() \
- (__ASSERT_(PL_numeric_standard == 2) \
- PL_numeric_standard = 1)
+ STMT_START { \
+ if (PL_numeric_standard > 1) { \
+ PL_numeric_standard--; \
+ } \
+ else { \
+ assert(0); \
+ } \
+ } STMT_END
#define RESTORE_LC_NUMERIC_UNDERLYING() \
if (_was_local) set_numeric_local();