Skip to content

Commit

Permalink
locale.c: Move setting errno out of critical section
Browse files Browse the repository at this point in the history
I doesn't matter much, but its better practice to make critical sections
as small as possible.
  • Loading branch information
khwilliamson committed May 12, 2023
1 parent 9ca4281 commit 1435814
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locale.c
Expand Up @@ -4691,8 +4691,8 @@ Perl_mbtowc_(pTHX_ const wchar_t * pwc, const char * s, const Size_t len)

# else

MBTOWC_LOCK_;
SETERRNO(0, 0);
MBTOWC_LOCK_;
retval = mbtowc(NULL, NULL, 0);
MBTOWC_UNLOCK_;
return retval;
Expand All @@ -4710,8 +4710,8 @@ Perl_mbtowc_(pTHX_ const wchar_t * pwc, const char * s, const Size_t len)

/* Locking prevents races, but locales can be switched out without locking,
* so this isn't a cure all */
MBTOWC_LOCK_;
SETERRNO(0, 0);
MBTOWC_LOCK_;
retval = mbtowc((wchar_t *) pwc, s, len);
MBTOWC_UNLOCK_;

Expand Down

0 comments on commit 1435814

Please sign in to comment.