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 Jul 16, 2023
1 parent ae4b4da commit e38e5c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -3173,8 +3173,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 @@ -3192,8 +3192,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 e38e5c7

Please sign in to comment.