diff options
author | Karl Williamson <khw@cpan.org> | 2020-11-30 10:11:01 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-12-08 06:44:20 -0700 |
commit | 7953f73fd803e53f20bdf0801f194691543b0f87 (patch) | |
tree | f878bb88c4abc11dbf96315da1283b57c1c6eecd /ext/POSIX | |
parent | d9e22c6a8a05aab7fffdbf810f74ddfcb4efd752 (diff) | |
download | perl-7953f73fd803e53f20bdf0801f194691543b0f87.tar.gz |
Name individual locale locks
These locks for different functions all use the same underlying mutex;
but that may not always be the case. By creating separate names
used only when we think they will be necessary, the compiler will
complain if the conditions in the code that actually use them are the
same. Doing this showed a misspelling in an #ifdef, fixed in
9289d4dc7a3d24b20c6e25045e687321ee3e8faf
Diffstat (limited to 'ext/POSIX')
-rw-r--r-- | ext/POSIX/POSIX.xs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 0f750c0dc6..6bd30e8474 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -3376,9 +3376,9 @@ mblen(s, n = ~0) memzero(&PL_mbrlen_ps, sizeof(PL_mbrlen_ps)); RETVAL = 0; #else - LOCALE_LOCK; + MBLEN_LOCK; RETVAL = mblen(NULL, 0); - LOCALE_UNLOCK; + MBLEN_UNLOCK; #endif } else { /* Not resetting state */ @@ -3398,9 +3398,9 @@ mblen(s, n = ~0) #else /* Locking prevents races, but locales can be switched out * without locking, so this isn't a cure all */ - LOCALE_LOCK; + MBLEN_LOCK; RETVAL = mblen(string, len); - LOCALE_UNLOCK; + MBLEN_UNLOCK; #endif } } @@ -3427,9 +3427,9 @@ mbtowc(pwc, s, n = ~0) memzero(&PL_mbrtowc_ps, sizeof(PL_mbrtowc_ps)); RETVAL = 0; #else - LOCALE_LOCK; + MBTOWC_LOCK; RETVAL = mbtowc(NULL, NULL, 0); - LOCALE_UNLOCK; + MBTOWC_UNLOCK; #endif } else { /* Not resetting state */ @@ -3448,9 +3448,9 @@ mbtowc(pwc, s, n = ~0) #else /* Locking prevents races, but locales can be switched out * without locking, so this isn't a cure all */ - LOCALE_LOCK; + MBTOWC_LOCK; RETVAL = mbtowc(&wc, string, len); - LOCALE_UNLOCK; + MBTOWC_UNLOCK; #endif if (RETVAL >= 0) { sv_setiv_mg(pwc, wc); @@ -3482,9 +3482,9 @@ wctomb(s, wchar) * But probably memzero would too */ RETVAL = wcrtomb(NULL, L'\0', &PL_wcrtomb_ps); #else - LOCALE_LOCK; + WCTOMB_LOCK; RETVAL = wctomb(NULL, L'\0'); - LOCALE_UNLOCK; + WCTOMB_UNLOCK; #endif } else { /* Not resetting state */ @@ -3494,9 +3494,9 @@ wctomb(s, wchar) #else /* Locking prevents races, but locales can be switched out without * locking, so this isn't a cure all */ - LOCALE_LOCK; + WCTOMB_LOCK; RETVAL = wctomb(buffer, wchar); - LOCALE_UNLOCK; + WCTOMB_UNLOCK; #endif if (RETVAL >= 0) { sv_setpvn_mg(s, buffer, RETVAL); |