summaryrefslogtreecommitdiff
path: root/gnulib/import/mbtowc-lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib/import/mbtowc-lock.h')
-rw-r--r--gnulib/import/mbtowc-lock.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/gnulib/import/mbtowc-lock.h b/gnulib/import/mbtowc-lock.h
index 696b12c5841..ecfd44e8ded 100644
--- a/gnulib/import/mbtowc-lock.h
+++ b/gnulib/import/mbtowc-lock.h
@@ -1,17 +1,17 @@
/* Use the internal lock used by mbrtowc and mbrtoc32.
- Copyright (C) 2019-2021 Free Software Foundation, Inc.
+ Copyright (C) 2019-2022 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020. */
@@ -32,7 +32,17 @@ mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
/* Prohibit renaming this symbol. */
#undef gl_get_mbtowc_lock
-#if defined _WIN32 && !defined __CYGWIN__
+#if GNULIB_MBRTOWC_SINGLE_THREAD
+
+/* All uses of this function are in a single thread. No locking needed. */
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+ return mbtowc_unlocked (pwc, p, m);
+}
+
+#elif defined _WIN32 && !defined __CYGWIN__
extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void);