mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
mbrtowc: Ensure the mbtowc_lock is unique.
* lib/mbtowc-lock.c: New file, based on lib/setlocale-lock.c. * lib/mbtowc-lock.h: New file, extracted from lib/mbrtowc.c and lib/setlocale_null.c. * lib/mbrtowc.c: Include headers needed for mbtowc-lock.h. Don't include glthread/lock.h. Include mbtowc-lock.h. (mbtowc_lock): Remove declaration. (mbrtowc): Use mbtowc_with_lock. * m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Require gl_PTHREADLIB. Check for threads.h. Set LIB_MBRTOWC. (gl_PREREQ_MBTOWC_LOCK): New macro. * modules/mbrtowc (Files): Add lib/mbtowc-lock.h, lib/mbtowc-lock.c, lib/windows-initguard.h, m4/threadlib.m4, m4/visibility.m4. (Depends-on): Remove lock. (configure.ac): Arrange to compile mbtowc-lock.c. (Link): Mention $(LIB_MBRTOWC) instead of $(LIBTHREAD). * modules/acl (Link): Likewise. * modules/argmatch (Link): Likewise. * modules/backup-rename (Link): Likewise. * modules/backupfile (Link): Likewise. * modules/closein (Link): Likewise. * modules/closeout (Link): Likewise. * modules/copy-file (Link): Likewise. * modules/csharpcomp (Link): Likewise. * modules/csharpexec (Link): Likewise. * modules/dfa (Link): Likewise. * modules/exclude (Link): Likewise. * modules/fnmatch (Link): Likewise. * modules/fnmatch-gnu (Link): Likewise. * modules/fnmatch-posix (Link): Likewise. * modules/glob (Link): Likewise. * modules/human (Link): Likewise. * modules/javacomp (Link): Likewise. * modules/javaexec (Link): Likewise. * modules/javaversion (Link): Likewise. * modules/mbfile (Link): Likewise. * modules/mbiter (Link): Likewise. * modules/mbmemcasecmp (Link): Likewise. * modules/mbmemcasecoll (Link): Likewise. * modules/mbrlen (Link): Likewise. * modules/mbscasecmp (Link): Likewise. * modules/mbscasestr (Link): Likewise. * modules/mbschr (Link): Likewise. * modules/mbscspn (Link): Likewise. * modules/mbsinit (Link): Likewise. * modules/mbslen (Link): Likewise. * modules/mbsncasecmp (Link): Likewise. * modules/mbsnlen (Link): Likewise. * modules/mbsnrtowcs (Link): Likewise. * modules/mbspbrk (Link): Likewise. * modules/mbspcasecmp (Link): Likewise. * modules/mbsrchr (Link): Likewise. * modules/mbsrtowcs (Link): Likewise. * modules/mbssep (Link): Likewise. * modules/mbsspn (Link): Likewise. * modules/mbsstr (Link): Likewise. * modules/mbstok_r (Link): Likewise. * modules/mbswidth (Link): Likewise. * modules/mbuiter (Link): Likewise. * modules/mkdir-p (Link): Likewise. * modules/propername (Link): Likewise. * modules/quote (Link): Likewise. * modules/quotearg (Link): Likewise. * modules/quotearg-simple (Link): Likewise. * modules/regex-quote (Link): Likewise. * modules/rpmatch (Link): Likewise. * modules/sh-quote (Link): Likewise. * modules/system-quote (Link): Likewise. * modules/trim (Link): Likewise. * modules/unistdio/ulc-asnprintf (Link): Likewise. * modules/unistdio/ulc-fprintf (Link): Likewise. * modules/unistdio/ulc-vasnprintf (Link): Likewise. * modules/unistdio/ulc-vasprintf (Link): Likewise. * modules/unistdio/ulc-vfprintf (Link): Likewise. * modules/unistdio/ulc-vsnprintf (Link): Likewise. * modules/unistdio/ulc-vsprintf (Link): Likewise. * modules/xfreopen (Link): Likewise. * modules/xmemcoll (Link): Likewise. * modules/yesno (Link): Likewise. * modules/regex (Link): Add $(LIB_MBRTOWC). * modules/acl-tests (Makefile.am): Link the programs with $(LIB_MBRTOWC) instead of $(LIBTHREAD). * modules/argmatch-tests (Makefile.am): Likewise. * modules/closein-tests (Makefile.am): Likewise. * modules/copy-file-tests (Makefile.am): Likewise. * modules/dfa-tests (Makefile.am): Likewise. * modules/fnmatch-tests (Makefile.am): Likewise. * modules/glob-tests (Makefile.am): Likewise. * modules/mbmemcasecmp-tests (Makefile.am): Likewise. * modules/mbmemcasecoll-tests (Makefile.am): Likewise. * modules/mbrtowc-tests (Makefile.am): Likewise. * modules/mbscasecmp-tests (Makefile.am): Likewise. * modules/mbscasestr-tests (Makefile.am): Likewise. * modules/mbschr-tests (Makefile.am): Likewise. * modules/mbscspn-tests (Makefile.am): Likewise. * modules/mbsinit-tests (Makefile.am): Likewise. * modules/mbsncasecmp-tests (Makefile.am): Likewise. * modules/mbsnrtowcs-tests (Makefile.am): Likewise. * modules/mbspbrk-tests (Makefile.am): Likewise. * modules/mbspcasecmp-tests (Makefile.am): Likewise. * modules/mbsrchr-tests (Makefile.am): Likewise. * modules/mbsrtowcs-tests (Makefile.am): Likewise. * modules/mbsspn-tests (Makefile.am): Likewise. * modules/mbsstr-tests (Makefile.am): Likewise. * modules/quotearg-simple-tests (Makefile.am): Likewise. * modules/quotearg-tests (Makefile.am): Likewise. * modules/readtokens-tests (Makefile.am): Likewise. * modules/sh-quote-tests (Makefile.am): Likewise. * modules/system-quote-tests (Makefile.am): Likewise. * modules/unistdio/ulc-asnprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vasprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vsnprintf-tests (Makefile.am): Likewise. * modules/unistdio/ulc-vsprintf-tests (Makefile.am): Likewise. * modules/yesno-tests (Makefile.am): Likewise. * modules/exclude-tests (Makefile.am): Link the programs with $(LIB_MBRTOWC). * modules/regex-tests (Makefile.am): Likewise. * modules/regex-quote-tests (Makefile.am): Likewise.
This commit is contained in:
122
ChangeLog
122
ChangeLog
@@ -1,3 +1,125 @@
|
||||
2020-01-03 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
mbrtowc: Ensure the mbtowc_lock is unique.
|
||||
* lib/mbtowc-lock.c: New file, based on lib/setlocale-lock.c.
|
||||
* lib/mbtowc-lock.h: New file, extracted from lib/mbrtowc.c and
|
||||
lib/setlocale_null.c.
|
||||
* lib/mbrtowc.c: Include headers needed for mbtowc-lock.h. Don't include
|
||||
glthread/lock.h. Include mbtowc-lock.h.
|
||||
(mbtowc_lock): Remove declaration.
|
||||
(mbrtowc): Use mbtowc_with_lock.
|
||||
* m4/mbrtowc.m4 (gl_FUNC_MBRTOWC): Require gl_PTHREADLIB. Check for
|
||||
threads.h. Set LIB_MBRTOWC.
|
||||
(gl_PREREQ_MBTOWC_LOCK): New macro.
|
||||
* modules/mbrtowc (Files): Add lib/mbtowc-lock.h, lib/mbtowc-lock.c,
|
||||
lib/windows-initguard.h, m4/threadlib.m4, m4/visibility.m4.
|
||||
(Depends-on): Remove lock.
|
||||
(configure.ac): Arrange to compile mbtowc-lock.c.
|
||||
(Link): Mention $(LIB_MBRTOWC) instead of $(LIBTHREAD).
|
||||
* modules/acl (Link): Likewise.
|
||||
* modules/argmatch (Link): Likewise.
|
||||
* modules/backup-rename (Link): Likewise.
|
||||
* modules/backupfile (Link): Likewise.
|
||||
* modules/closein (Link): Likewise.
|
||||
* modules/closeout (Link): Likewise.
|
||||
* modules/copy-file (Link): Likewise.
|
||||
* modules/csharpcomp (Link): Likewise.
|
||||
* modules/csharpexec (Link): Likewise.
|
||||
* modules/dfa (Link): Likewise.
|
||||
* modules/exclude (Link): Likewise.
|
||||
* modules/fnmatch (Link): Likewise.
|
||||
* modules/fnmatch-gnu (Link): Likewise.
|
||||
* modules/fnmatch-posix (Link): Likewise.
|
||||
* modules/glob (Link): Likewise.
|
||||
* modules/human (Link): Likewise.
|
||||
* modules/javacomp (Link): Likewise.
|
||||
* modules/javaexec (Link): Likewise.
|
||||
* modules/javaversion (Link): Likewise.
|
||||
* modules/mbfile (Link): Likewise.
|
||||
* modules/mbiter (Link): Likewise.
|
||||
* modules/mbmemcasecmp (Link): Likewise.
|
||||
* modules/mbmemcasecoll (Link): Likewise.
|
||||
* modules/mbrlen (Link): Likewise.
|
||||
* modules/mbscasecmp (Link): Likewise.
|
||||
* modules/mbscasestr (Link): Likewise.
|
||||
* modules/mbschr (Link): Likewise.
|
||||
* modules/mbscspn (Link): Likewise.
|
||||
* modules/mbsinit (Link): Likewise.
|
||||
* modules/mbslen (Link): Likewise.
|
||||
* modules/mbsncasecmp (Link): Likewise.
|
||||
* modules/mbsnlen (Link): Likewise.
|
||||
* modules/mbsnrtowcs (Link): Likewise.
|
||||
* modules/mbspbrk (Link): Likewise.
|
||||
* modules/mbspcasecmp (Link): Likewise.
|
||||
* modules/mbsrchr (Link): Likewise.
|
||||
* modules/mbsrtowcs (Link): Likewise.
|
||||
* modules/mbssep (Link): Likewise.
|
||||
* modules/mbsspn (Link): Likewise.
|
||||
* modules/mbsstr (Link): Likewise.
|
||||
* modules/mbstok_r (Link): Likewise.
|
||||
* modules/mbswidth (Link): Likewise.
|
||||
* modules/mbuiter (Link): Likewise.
|
||||
* modules/mkdir-p (Link): Likewise.
|
||||
* modules/propername (Link): Likewise.
|
||||
* modules/quote (Link): Likewise.
|
||||
* modules/quotearg (Link): Likewise.
|
||||
* modules/quotearg-simple (Link): Likewise.
|
||||
* modules/regex-quote (Link): Likewise.
|
||||
* modules/rpmatch (Link): Likewise.
|
||||
* modules/sh-quote (Link): Likewise.
|
||||
* modules/system-quote (Link): Likewise.
|
||||
* modules/trim (Link): Likewise.
|
||||
* modules/unistdio/ulc-asnprintf (Link): Likewise.
|
||||
* modules/unistdio/ulc-fprintf (Link): Likewise.
|
||||
* modules/unistdio/ulc-vasnprintf (Link): Likewise.
|
||||
* modules/unistdio/ulc-vasprintf (Link): Likewise.
|
||||
* modules/unistdio/ulc-vfprintf (Link): Likewise.
|
||||
* modules/unistdio/ulc-vsnprintf (Link): Likewise.
|
||||
* modules/unistdio/ulc-vsprintf (Link): Likewise.
|
||||
* modules/xfreopen (Link): Likewise.
|
||||
* modules/xmemcoll (Link): Likewise.
|
||||
* modules/yesno (Link): Likewise.
|
||||
* modules/regex (Link): Add $(LIB_MBRTOWC).
|
||||
* modules/acl-tests (Makefile.am): Link the programs with $(LIB_MBRTOWC)
|
||||
instead of $(LIBTHREAD).
|
||||
* modules/argmatch-tests (Makefile.am): Likewise.
|
||||
* modules/closein-tests (Makefile.am): Likewise.
|
||||
* modules/copy-file-tests (Makefile.am): Likewise.
|
||||
* modules/dfa-tests (Makefile.am): Likewise.
|
||||
* modules/fnmatch-tests (Makefile.am): Likewise.
|
||||
* modules/glob-tests (Makefile.am): Likewise.
|
||||
* modules/mbmemcasecmp-tests (Makefile.am): Likewise.
|
||||
* modules/mbmemcasecoll-tests (Makefile.am): Likewise.
|
||||
* modules/mbrtowc-tests (Makefile.am): Likewise.
|
||||
* modules/mbscasecmp-tests (Makefile.am): Likewise.
|
||||
* modules/mbscasestr-tests (Makefile.am): Likewise.
|
||||
* modules/mbschr-tests (Makefile.am): Likewise.
|
||||
* modules/mbscspn-tests (Makefile.am): Likewise.
|
||||
* modules/mbsinit-tests (Makefile.am): Likewise.
|
||||
* modules/mbsncasecmp-tests (Makefile.am): Likewise.
|
||||
* modules/mbsnrtowcs-tests (Makefile.am): Likewise.
|
||||
* modules/mbspbrk-tests (Makefile.am): Likewise.
|
||||
* modules/mbspcasecmp-tests (Makefile.am): Likewise.
|
||||
* modules/mbsrchr-tests (Makefile.am): Likewise.
|
||||
* modules/mbsrtowcs-tests (Makefile.am): Likewise.
|
||||
* modules/mbsspn-tests (Makefile.am): Likewise.
|
||||
* modules/mbsstr-tests (Makefile.am): Likewise.
|
||||
* modules/quotearg-simple-tests (Makefile.am): Likewise.
|
||||
* modules/quotearg-tests (Makefile.am): Likewise.
|
||||
* modules/readtokens-tests (Makefile.am): Likewise.
|
||||
* modules/sh-quote-tests (Makefile.am): Likewise.
|
||||
* modules/system-quote-tests (Makefile.am): Likewise.
|
||||
* modules/unistdio/ulc-asnprintf-tests (Makefile.am): Likewise.
|
||||
* modules/unistdio/ulc-vasnprintf-tests (Makefile.am): Likewise.
|
||||
* modules/unistdio/ulc-vasprintf-tests (Makefile.am): Likewise.
|
||||
* modules/unistdio/ulc-vsnprintf-tests (Makefile.am): Likewise.
|
||||
* modules/unistdio/ulc-vsprintf-tests (Makefile.am): Likewise.
|
||||
* modules/yesno-tests (Makefile.am): Likewise.
|
||||
* modules/exclude-tests (Makefile.am): Link the programs with
|
||||
$(LIB_MBRTOWC).
|
||||
* modules/regex-tests (Makefile.am): Likewise.
|
||||
* modules/regex-quote-tests (Makefile.am): Likewise.
|
||||
|
||||
2020-01-03 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
getopt-posix: Fix compilation failure in testdirs.
|
||||
|
@@ -32,10 +32,32 @@
|
||||
# include <stdint.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
# if defined _WIN32 && !defined __CYGWIN__
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
|
||||
# include <windows.h>
|
||||
|
||||
# elif HAVE_PTHREAD_API
|
||||
|
||||
# include <pthread.h>
|
||||
# if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
|
||||
# include <threads.h>
|
||||
# pragma weak thrd_exit
|
||||
# define c11_threads_in_use() (thrd_exit != NULL)
|
||||
# else
|
||||
# define c11_threads_in_use() 0
|
||||
# endif
|
||||
|
||||
# elif HAVE_THREADS_H
|
||||
|
||||
# include <threads.h>
|
||||
|
||||
# endif
|
||||
|
||||
# include "localcharset.h"
|
||||
# include "streq.h"
|
||||
# include "verify.h"
|
||||
# include "glthread/lock.h"
|
||||
# include "mbtowc-lock.h"
|
||||
|
||||
# ifndef FALLTHROUGH
|
||||
# if __GNUC__ < 7
|
||||
@@ -93,12 +115,7 @@ locale_enc_cached (void)
|
||||
# define locale_enc_cached locale_enc
|
||||
# endif
|
||||
|
||||
/* This lock protects the internal state of mbtowc against multiple simultaneous
|
||||
calls of mbrtowc. */
|
||||
gl_lock_define_initialized(static, mbtowc_lock)
|
||||
|
||||
verify (sizeof (mbstate_t) >= 4);
|
||||
|
||||
static char internal_state[4];
|
||||
|
||||
size_t
|
||||
@@ -286,16 +303,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||
{
|
||||
/* The hidden internal state of mbtowc would make this function not
|
||||
multi-thread safe. Achieve multi-thread safety through a lock. */
|
||||
gl_lock_lock (mbtowc_lock);
|
||||
|
||||
/* Put the hidden internal state of mbtowc into its initial state.
|
||||
This is needed at least with glibc, uClibc, and MSVC CRT.
|
||||
See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */
|
||||
mbtowc (NULL, NULL, 0);
|
||||
|
||||
res = mbtowc (pwc, p, m);
|
||||
|
||||
gl_lock_unlock (mbtowc_lock);
|
||||
res = mbtowc_with_lock (pwc, p, m);
|
||||
|
||||
if (res >= 0)
|
||||
{
|
||||
|
150
lib/mbtowc-lock.c
Normal file
150
lib/mbtowc-lock.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/* Return the internal lock used by mbrtowc and mbrtoc32.
|
||||
Copyright (C) 2019-2020 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 program 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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* When it is known that the gl_get_mbtowc_lock function is defined
|
||||
by a dependency library, it should not be defined here. */
|
||||
#if OMIT_MBTOWC_LOCK
|
||||
|
||||
/* This declaration is solely to ensure that after preprocessing
|
||||
this file is never empty. */
|
||||
typedef int dummy;
|
||||
|
||||
#else
|
||||
|
||||
/* This file defines the internal lock used by mbrtowc and mbrtoc32.
|
||||
It is a separate compilation unit, so that only one copy of it is
|
||||
present when linking statically. */
|
||||
|
||||
/* Prohibit renaming this symbol. */
|
||||
# undef gl_get_mbtowc_lock
|
||||
|
||||
/* Macro for exporting a symbol (function, not variable) defined in this file,
|
||||
when compiled into a shared library. */
|
||||
# ifndef DLL_EXPORTED
|
||||
# if HAVE_VISIBILITY
|
||||
/* Override the effect of the compiler option '-fvisibility=hidden'. */
|
||||
# define DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
# elif defined _WIN32 || defined __CYGWIN__
|
||||
# define DLL_EXPORTED __declspec(dllexport)
|
||||
# else
|
||||
# define DLL_EXPORTED
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if defined _WIN32 && !defined __CYGWIN__
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
|
||||
# include <windows.h>
|
||||
|
||||
# include "windows-initguard.h"
|
||||
|
||||
/* The return type is a 'CRITICAL_SECTION *', not a 'glwthread_mutex_t *',
|
||||
because the latter is not guaranteed to be a stable ABI in the future. */
|
||||
|
||||
/* Make sure the function gets exported from DLLs. */
|
||||
DLL_EXPORTED CRITICAL_SECTION *gl_get_mbtowc_lock (void);
|
||||
|
||||
static glwthread_initguard_t guard = GLWTHREAD_INITGUARD_INIT;
|
||||
static CRITICAL_SECTION lock;
|
||||
|
||||
/* Returns the internal lock used by mbrtowc and mbrtoc32. */
|
||||
CRITICAL_SECTION *
|
||||
gl_get_mbtowc_lock (void)
|
||||
{
|
||||
if (!guard.done)
|
||||
{
|
||||
if (InterlockedIncrement (&guard.started) == 0)
|
||||
{
|
||||
/* This thread is the first one to need the lock. Initialize it. */
|
||||
InitializeCriticalSection (&lock);
|
||||
guard.done = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Don't let guard.started grow and wrap around. */
|
||||
InterlockedDecrement (&guard.started);
|
||||
/* Yield the CPU while waiting for another thread to finish
|
||||
initializing this mutex. */
|
||||
while (!guard.done)
|
||||
Sleep (0);
|
||||
}
|
||||
}
|
||||
return &lock;
|
||||
}
|
||||
|
||||
# elif HAVE_PTHREAD_API
|
||||
|
||||
# include <pthread.h>
|
||||
|
||||
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* Make sure the function gets exported from shared libraries. */
|
||||
DLL_EXPORTED pthread_mutex_t *gl_get_mbtowc_lock (void);
|
||||
|
||||
/* Returns the internal lock used by mbrtowc and mbrtoc32. */
|
||||
pthread_mutex_t *
|
||||
gl_get_mbtowc_lock (void)
|
||||
{
|
||||
return &mutex;
|
||||
}
|
||||
|
||||
# elif HAVE_THREADS_H
|
||||
|
||||
# include <threads.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
static int volatile init_needed = 1;
|
||||
static once_flag init_once = ONCE_FLAG_INIT;
|
||||
static mtx_t mutex;
|
||||
|
||||
static void
|
||||
atomic_init (void)
|
||||
{
|
||||
if (mtx_init (&mutex, mtx_plain) != thrd_success)
|
||||
abort ();
|
||||
init_needed = 0;
|
||||
}
|
||||
|
||||
/* Make sure the function gets exported from shared libraries. */
|
||||
DLL_EXPORTED mtx_t *gl_get_mbtowc_lock (void);
|
||||
|
||||
/* Returns the internal lock used by mbrtowc and mbrtoc32. */
|
||||
mtx_t *
|
||||
gl_get_mbtowc_lock (void)
|
||||
{
|
||||
if (init_needed)
|
||||
call_once (&init_once, atomic_init);
|
||||
return &mutex;
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
# if (defined _WIN32 || defined __CYGWIN__) && !defined _MSC_VER
|
||||
/* Make sure the '__declspec(dllimport)' in mbrtowc.c and mbrtoc32.c does not
|
||||
cause a link failure when no DLLs are involved. */
|
||||
# if defined _WIN64 || defined _LP64
|
||||
# define IMP(x) __imp_##x
|
||||
# else
|
||||
# define IMP(x) _imp__##x
|
||||
# endif
|
||||
void * IMP(gl_get_mbtowc_lock) = &gl_get_mbtowc_lock;
|
||||
# endif
|
||||
|
||||
#endif
|
115
lib/mbtowc-lock.h
Normal file
115
lib/mbtowc-lock.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/* Use the internal lock used by mbrtowc and mbrtoc32.
|
||||
Copyright (C) 2019-2020 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 program 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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Bruno Haible <bruno@clisp.org>, 2019-2020. */
|
||||
|
||||
/* Use a lock, so that no two threads can invoke mbtowc at the same time. */
|
||||
|
||||
static inline int
|
||||
mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
|
||||
{
|
||||
/* Put the hidden internal state of mbtowc into its initial state.
|
||||
This is needed at least with glibc, uClibc, and MSVC CRT.
|
||||
See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */
|
||||
mbtowc (NULL, NULL, 0);
|
||||
|
||||
return mbtowc (pwc, p, m);
|
||||
}
|
||||
|
||||
/* Prohibit renaming this symbol. */
|
||||
#undef gl_get_mbtowc_lock
|
||||
|
||||
#if defined _WIN32 && !defined __CYGWIN__
|
||||
|
||||
extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void);
|
||||
|
||||
static int
|
||||
mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
|
||||
{
|
||||
CRITICAL_SECTION *lock = gl_get_mbtowc_lock ();
|
||||
int ret;
|
||||
|
||||
EnterCriticalSection (lock);
|
||||
ret = mbtowc_unlocked (pwc, p, m);
|
||||
LeaveCriticalSection (lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#elif HAVE_PTHREAD_API /* AIX, IRIX, Cygwin */
|
||||
|
||||
extern
|
||||
# if defined _WIN32 || defined __CYGWIN__
|
||||
__declspec(dllimport)
|
||||
# endif
|
||||
pthread_mutex_t *gl_get_mbtowc_lock (void);
|
||||
|
||||
# if HAVE_WEAK_SYMBOLS /* IRIX */
|
||||
|
||||
/* Avoid the need to link with '-lpthread'. */
|
||||
# pragma weak pthread_mutex_lock
|
||||
# pragma weak pthread_mutex_unlock
|
||||
|
||||
/* Determine whether libpthread is in use. */
|
||||
# pragma weak pthread_mutexattr_gettype
|
||||
/* See the comments in lock.h. */
|
||||
# define pthread_in_use() \
|
||||
(pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
|
||||
|
||||
# else
|
||||
# define pthread_in_use() 1
|
||||
# endif
|
||||
|
||||
static int
|
||||
mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
|
||||
{
|
||||
if (pthread_in_use())
|
||||
{
|
||||
pthread_mutex_t *lock = gl_get_mbtowc_lock ();
|
||||
int ret;
|
||||
|
||||
if (pthread_mutex_lock (lock))
|
||||
abort ();
|
||||
ret = mbtowc_unlocked (pwc, p, m);
|
||||
if (pthread_mutex_unlock (lock))
|
||||
abort ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return mbtowc_unlocked (pwc, p, m);
|
||||
}
|
||||
|
||||
#elif HAVE_THREADS_H
|
||||
|
||||
extern mtx_t *gl_get_mbtowc_lock (void);
|
||||
|
||||
static int
|
||||
mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
|
||||
{
|
||||
mtx_t *lock = gl_get_mbtowc_lock ();
|
||||
int ret;
|
||||
|
||||
if (mtx_lock (lock) != thrd_success)
|
||||
abort ();
|
||||
ret = mbtowc_unlocked (pwc, p, m);
|
||||
if (mtx_unlock (lock) != thrd_success)
|
||||
abort ();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,4 +1,4 @@
|
||||
# mbrtowc.m4 serial 36 -*- coding: utf-8 -*-
|
||||
# mbrtowc.m4 serial 37 -*- coding: utf-8 -*-
|
||||
dnl Copyright (C) 2001-2002, 2004-2005, 2008-2020 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
@@ -8,6 +8,8 @@ dnl with or without modifications, as long as this notice is preserved.
|
||||
AC_DEFUN([gl_FUNC_MBRTOWC],
|
||||
[
|
||||
AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_PTHREADLIB])
|
||||
AC_CHECK_HEADERS_ONCE([threads.h])
|
||||
|
||||
AC_REQUIRE([AC_TYPE_MBSTATE_T])
|
||||
gl_MBSTATE_T_BROKEN
|
||||
@@ -94,6 +96,23 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if test $REPLACE_MBSTATE_T = 1; then
|
||||
case "$host_os" in
|
||||
mingw*) LIB_MBRTOWC= ;;
|
||||
*)
|
||||
gl_WEAK_SYMBOLS
|
||||
case "$gl_cv_have_weak" in
|
||||
*yes) LIB_MBRTOWC= ;;
|
||||
*) LIB_MBRTOWC="$LIBPTHREAD" ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
else
|
||||
LIB_MBRTOWC=
|
||||
fi
|
||||
dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX
|
||||
dnl with gcc or xlc, and empty otherwise.
|
||||
AC_SUBST([LIB_MBRTOWC])
|
||||
])
|
||||
|
||||
dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that
|
||||
@@ -808,6 +827,12 @@ AC_DEFUN([gl_PREREQ_MBRTOWC], [
|
||||
:
|
||||
])
|
||||
|
||||
# Prerequisites of lib/mbtowc-lock.c.
|
||||
AC_DEFUN([gl_PREREQ_MBTOWC_LOCK],
|
||||
[
|
||||
gl_VISIBILITY
|
||||
])
|
||||
|
||||
|
||||
dnl From Paul Eggert
|
||||
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"acl.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -25,6 +25,6 @@ TESTS += \
|
||||
test-copy-acl.sh test-copy-acl-1.sh test-copy-acl-2.sh
|
||||
TESTS_ENVIRONMENT += USE_ACL=$(USE_ACL)
|
||||
check_PROGRAMS += test-set-mode-acl test-copy-acl test-sameacls
|
||||
test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIBTHREAD)
|
||||
test_copy_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIBTHREAD)
|
||||
test_sameacls_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIBTHREAD)
|
||||
test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
test_copy_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
test_sameacls_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -27,7 +27,7 @@ Include:
|
||||
"argmatch.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -9,5 +9,5 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-argmatch
|
||||
check_PROGRAMS += test-argmatch
|
||||
test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_argmatch_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
||||
|
@@ -33,7 +33,7 @@ Include:
|
||||
"backupfile.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -34,7 +34,7 @@ Include:
|
||||
"backupfile.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
"closein.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -12,4 +12,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-closein.sh
|
||||
check_PROGRAMS += test-closein
|
||||
test_closein_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_closein_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"closeout.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -34,7 +34,7 @@ Include:
|
||||
"copy-file.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -18,4 +18,4 @@ Makefile.am:
|
||||
TESTS += test-copy-file.sh test-copy-file-1.sh test-copy-file-2.sh
|
||||
TESTS_ENVIRONMENT += USE_ACL=$(USE_ACL)
|
||||
check_PROGRAMS += test-copy-file
|
||||
test_copy_file_LDADD = $(LDADD) $(LIB_ACL) $(LIB_CLOCK_GETTIME) @LIBINTL@ $(LIBTHREAD)
|
||||
test_copy_file_LDADD = $(LDADD) $(LIB_ACL) $(LIB_CLOCK_GETTIME) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -28,7 +28,7 @@ Include:
|
||||
"csharpcomp.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -28,7 +28,7 @@ Include:
|
||||
"csharpexec.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -38,7 +38,7 @@ Include:
|
||||
"localeinfo.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -18,4 +18,4 @@ TESTS += \
|
||||
dfa-match.sh
|
||||
|
||||
check_PROGRAMS += dfa-match-aux
|
||||
dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)
|
||||
dfa_match_aux_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -25,7 +25,7 @@ Include:
|
||||
"exclude.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -26,4 +26,4 @@ TESTS += \
|
||||
test-exclude8.sh
|
||||
|
||||
check_PROGRAMS += test-exclude
|
||||
test_exclude_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_exclude_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC) $(LIBTHREAD)
|
||||
|
@@ -34,7 +34,7 @@ Include:
|
||||
<fnmatch.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
<fnmatch.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
"fnmatch.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -6,4 +6,4 @@ tests/macros.h
|
||||
Makefile.am:
|
||||
TESTS += test-fnmatch
|
||||
check_PROGRAMS += test-fnmatch
|
||||
test_fnmatch_LDADD = $(LDADD) $(LIBTHREAD)
|
||||
test_fnmatch_LDADD = $(LDADD) $(LIB_MBRTOWC)
|
||||
|
@@ -50,7 +50,7 @@ Include:
|
||||
<glob.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -11,4 +11,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-glob
|
||||
check_PROGRAMS += test-glob
|
||||
test_glob_LDADD = $(LDADD) $(LIBTHREAD)
|
||||
test_glob_LDADD = $(LDADD) $(LIB_MBRTOWC)
|
||||
|
@@ -27,7 +27,7 @@ Include:
|
||||
"human.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -39,7 +39,7 @@ Include:
|
||||
"javacomp.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -29,7 +29,7 @@ Include:
|
||||
"javaexec.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -26,7 +26,7 @@ Include:
|
||||
"javaversion.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -25,7 +25,7 @@ Include:
|
||||
"mbfile.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -25,7 +25,7 @@ Include:
|
||||
"mbiter.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -17,7 +17,7 @@ Include:
|
||||
"mbmemcasecmp.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -25,4 +25,4 @@ TESTS_ENVIRONMENT += \
|
||||
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
|
||||
LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
|
||||
check_PROGRAMS += test-mbmemcasecmp
|
||||
test_mbmemcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbmemcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -24,7 +24,7 @@ Include:
|
||||
"mbmemcasecoll.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -25,4 +25,4 @@ TESTS_ENVIRONMENT += \
|
||||
LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
|
||||
LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
|
||||
check_PROGRAMS += test-mbmemcasecoll
|
||||
test_mbmemcasecoll_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbmemcasecoll_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -25,7 +25,7 @@ Include:
|
||||
<wchar.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -3,12 +3,17 @@ mbrtowc() function: convert multibyte character to wide character.
|
||||
|
||||
Files:
|
||||
lib/mbrtowc.c
|
||||
lib/mbtowc-lock.h
|
||||
lib/mbtowc-lock.c
|
||||
lib/windows-initguard.h
|
||||
m4/mbrtowc.m4
|
||||
m4/mbstate_t.m4
|
||||
m4/locale-fr.m4
|
||||
m4/locale-ja.m4
|
||||
m4/locale-zh.m4
|
||||
m4/codeset.m4
|
||||
m4/threadlib.m4
|
||||
m4/visibility.m4
|
||||
|
||||
Depends-on:
|
||||
wchar
|
||||
@@ -19,13 +24,14 @@ mbsinit [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
|
||||
localcharset [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
|
||||
streq [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
|
||||
verify [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
|
||||
lock [test $HAVE_MBRTOWC = 0 || { test $REPLACE_MBRTOWC = 1 && { test $HAVE_MBSINIT = 0 || test $REPLACE_MBSTATE_T = 1; }; }]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_MBRTOWC
|
||||
if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
|
||||
AC_LIBOBJ([mbrtowc])
|
||||
AC_LIBOBJ([mbtowc-lock])
|
||||
gl_PREREQ_MBRTOWC
|
||||
gl_PREREQ_MBTOWC_LOCK
|
||||
fi
|
||||
gl_WCHAR_MODULE_INDICATOR([mbrtowc])
|
||||
|
||||
@@ -35,7 +41,7 @@ Include:
|
||||
<wchar.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -45,4 +45,4 @@ TESTS_ENVIRONMENT += \
|
||||
LOCALE_JA='@LOCALE_JA@' \
|
||||
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbrtowc test-mbrtowc-w32
|
||||
test_mbrtowc_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbrtowc_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbscasecmp.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
|
||||
check_PROGRAMS += test-mbscasecmp
|
||||
test_mbscasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbscasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -23,7 +23,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -24,7 +24,7 @@ Makefile.am:
|
||||
TESTS += test-mbscasestr1 test-mbscasestr2.sh test-mbscasestr3.sh test-mbscasestr4.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbscasestr1 test-mbscasestr2 test-mbscasestr3 test-mbscasestr4
|
||||
test_mbscasestr1_LDADD = $(LDADD) $(LIBTHREAD)
|
||||
test_mbscasestr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbscasestr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbscasestr4_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbscasestr1_LDADD = $(LDADD) $(LIB_MBRTOWC)
|
||||
test_mbscasestr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
test_mbscasestr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
test_mbscasestr4_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbschr.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbschr
|
||||
test_mbschr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbschr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbscspn.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
|
||||
check_PROGRAMS += test-mbscspn
|
||||
test_mbscspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbscspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -26,7 +26,7 @@ Include:
|
||||
<wchar.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -17,4 +17,4 @@ Makefile.am:
|
||||
TESTS += test-mbsinit.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
|
||||
check_PROGRAMS += test-mbsinit
|
||||
test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsinit_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbsncasecmp.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
|
||||
check_PROGRAMS += test-mbsncasecmp
|
||||
test_mbsncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsncasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -30,7 +30,7 @@ Include:
|
||||
<wchar.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -31,4 +31,4 @@ TESTS_ENVIRONMENT += \
|
||||
LOCALE_JA='@LOCALE_JA@' \
|
||||
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbsnrtowcs
|
||||
test_mbsnrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsnrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbspbrk.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
|
||||
check_PROGRAMS += test-mbspbrk
|
||||
test_mbspbrk_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbspbrk_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbspcasecmp.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
|
||||
check_PROGRAMS += test-mbspcasecmp
|
||||
test_mbspcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbspcasecmp_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbsrchr.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbsrchr
|
||||
test_mbsrchr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsrchr_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -33,7 +33,7 @@ Include:
|
||||
<wchar.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv2+
|
||||
|
@@ -31,4 +31,4 @@ TESTS_ENVIRONMENT += \
|
||||
LOCALE_JA='@LOCALE_JA@' \
|
||||
LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbsrtowcs
|
||||
test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsrtowcs_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -20,7 +20,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -19,7 +19,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -15,4 +15,4 @@ Makefile.am:
|
||||
TESTS += test-mbsspn.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
|
||||
check_PROGRAMS += test-mbsspn
|
||||
test_mbsspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsspn_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -23,7 +23,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -20,6 +20,6 @@ Makefile.am:
|
||||
TESTS += test-mbsstr1 test-mbsstr2.sh test-mbsstr3.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' LOCALE_ZH_CN='@LOCALE_ZH_CN@'
|
||||
check_PROGRAMS += test-mbsstr1 test-mbsstr2 test-mbsstr3
|
||||
test_mbsstr1_LDADD = $(LDADD) $(LIBTHREAD)
|
||||
test_mbsstr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsstr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBTHREAD)
|
||||
test_mbsstr1_LDADD = $(LDADD) $(LIB_MBRTOWC)
|
||||
test_mbsstr2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
test_mbsstr3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC)
|
||||
|
@@ -21,7 +21,7 @@ Include:
|
||||
<string.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -26,7 +26,7 @@ Include:
|
||||
"mbswidth.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -26,7 +26,7 @@ Include:
|
||||
"mbuiter.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPL
|
||||
|
@@ -34,7 +34,7 @@ Include:
|
||||
"mkdir-p.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -36,7 +36,7 @@ Include:
|
||||
"propername.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -17,7 +17,7 @@ Include:
|
||||
"quote.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -35,7 +35,7 @@ Include:
|
||||
"quotearg.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -13,7 +13,7 @@ Makefile.am:
|
||||
Include:
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -18,4 +18,4 @@ AC_CHECK_FUNCS_ONCE([mprotect])
|
||||
Makefile.am:
|
||||
TESTS += test-quotearg-simple
|
||||
check_PROGRAMS += test-quotearg-simple
|
||||
test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_quotearg_simple_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -27,4 +27,4 @@ Makefile.am:
|
||||
TESTS += test-quotearg.sh
|
||||
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
|
||||
check_PROGRAMS += test-quotearg
|
||||
test_quotearg_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)
|
||||
test_quotearg_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -11,4 +11,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-readtokens.sh
|
||||
check_PROGRAMS += test-readtokens
|
||||
test_readtokens_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_readtokens_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -49,6 +49,7 @@ Include:
|
||||
<regex.h>
|
||||
|
||||
Link:
|
||||
$(LIB_MBRTOWC)
|
||||
$(LIBTHREAD)
|
||||
$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
|
||||
|
||||
|
@@ -19,7 +19,7 @@ Include:
|
||||
"regex-quote.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -11,4 +11,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-regex-quote
|
||||
check_PROGRAMS += test-regex-quote
|
||||
test_regex_quote_LDADD = $(LDADD) $(LIBINTL) $(LIBTHREAD)
|
||||
test_regex_quote_LDADD = $(LDADD) $(LIBINTL) $(LIB_MBRTOWC) $(LIBTHREAD)
|
||||
|
@@ -11,4 +11,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-regex
|
||||
check_PROGRAMS += test-regex
|
||||
test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) @LIBINTL@ $(LIBTHREAD)
|
||||
test_regex_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIB_MBRTOWC) @LIBINTL@ $(LIBTHREAD)
|
||||
|
@@ -27,7 +27,7 @@ Include:
|
||||
<stdlib.h>
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
|
||||
|
||||
License:
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
"sh-quote.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -8,4 +8,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-sh-quote
|
||||
check_PROGRAMS += test-sh-quote
|
||||
test_sh_quote_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_sh_quote_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
|
@@ -18,7 +18,7 @@ Include:
|
||||
"system-quote.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -18,7 +18,7 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-system-quote.sh
|
||||
check_PROGRAMS += test-system-quote-main test-system-quote-child
|
||||
test_system_quote_main_LDADD = $(LDADD) @LIBINTL@ $(LIBTHREAD)
|
||||
test_system_quote_main_LDADD = $(LDADD) @LIBINTL@ $(LIB_MBRTOWC)
|
||||
# The test-system-quote-child program must be a real executable, not a libtool
|
||||
# wrapper script, and should link against as few libraries as possible.
|
||||
# Therefore don't link it against any libraries other than -lc.
|
||||
|
@@ -21,7 +21,7 @@ Include:
|
||||
"trim.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"unistdio.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv3+ or GPLv2
|
||||
|
@@ -12,4 +12,4 @@ Makefile.am:
|
||||
TESTS += test-ulc-asnprintf1
|
||||
check_PROGRAMS += test-ulc-asnprintf1
|
||||
test_ulc_asnprintf1_SOURCES = unistdio/test-ulc-asnprintf1.c
|
||||
test_ulc_asnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
|
||||
test_ulc_asnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"unistdio.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv3+ or GPLv2
|
||||
|
@@ -58,7 +58,7 @@ Include:
|
||||
"unistdio.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv3+ or GPLv2
|
||||
|
@@ -22,8 +22,8 @@ TESTS += test-ulc-vasnprintf1 unistdio/test-ulc-vasnprintf2.sh unistdio/test-ulc
|
||||
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_FR_UTF8='@LOCALE_FR_UTF8@'
|
||||
check_PROGRAMS += test-ulc-vasnprintf1 test-ulc-vasnprintf2 test-ulc-vasnprintf3
|
||||
test_ulc_vasnprintf1_SOURCES = unistdio/test-ulc-vasnprintf1.c
|
||||
test_ulc_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
|
||||
test_ulc_vasnprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
|
||||
test_ulc_vasnprintf2_SOURCES = unistdio/test-ulc-vasnprintf2.c
|
||||
test_ulc_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
|
||||
test_ulc_vasnprintf2_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
|
||||
test_ulc_vasnprintf3_SOURCES = unistdio/test-ulc-vasnprintf3.c
|
||||
test_ulc_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
|
||||
test_ulc_vasnprintf3_LDADD = $(LDADD) $(LIB_SETLOCALE) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"unistdio.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv3+ or GPLv2
|
||||
|
@@ -11,4 +11,4 @@ Makefile.am:
|
||||
TESTS += test-ulc-vasprintf1
|
||||
check_PROGRAMS += test-ulc-vasprintf1
|
||||
test_ulc_vasprintf1_SOURCES = unistdio/test-ulc-vasprintf1.c
|
||||
test_ulc_vasprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIBTHREAD)
|
||||
test_ulc_vasprintf1_LDADD = $(LDADD) $(LIBUNISTRING) @LIBICONV@ $(LIB_MBRTOWC)
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"unistdio.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv3+ or GPLv2
|
||||
|
@@ -22,7 +22,7 @@ Include:
|
||||
"unistdio.h"
|
||||
|
||||
Link:
|
||||
$(LIBTHREAD)
|
||||
$(LIB_MBRTOWC)
|
||||
|
||||
License:
|
||||
LGPLv3+ or GPLv2
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user