Fixes #816.
Ensure thread safety by ensuring that tag_defs[] is thread local. This has some overhead but is negligible on modern systems.
This commit is contained in:
parent
c8fbde5903
commit
28068b1273
|
@ -507,12 +507,12 @@ extern "C" {
|
||||||
# define setmode _setmode
|
# define setmode _setmode
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(_MSC_VER)
|
# if defined(_MSC_VER)
|
||||||
# define fileno _fileno
|
# define fileno _fileno
|
||||||
#if !defined(NDEBUG) && !defined(ENABLE_DEBUG_LOG) && !defined(DISABLE_DEBUG_LOG)
|
# if !defined(NDEBUG) && !defined(ENABLE_DEBUG_LOG) && !defined(DISABLE_DEBUG_LOG)
|
||||||
#define ENABLE_DEBUG_LOG
|
# define ENABLE_DEBUG_LOG
|
||||||
#endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
# define access _access
|
# define access _access
|
||||||
# define strcasecmp _stricmp
|
# define strcasecmp _stricmp
|
||||||
|
@ -553,6 +553,13 @@ extern "C" {
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifndef TIDY_THREAD_LOCAL
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
# define TIDY_THREAD_LOCAL __declspec( thread )
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
|
||||||
|
@ -600,6 +607,10 @@ extern "C" {
|
||||||
# define TIDY_STRUCT
|
# define TIDY_STRUCT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TIDY_THREAD_LOCAL
|
||||||
|
# define TIDY_THREAD_LOCAL __thread
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
typedef uint tchar; /* single, full character */
|
typedef uint tchar; /* single, full character */
|
||||||
|
|
|
@ -166,7 +166,7 @@ static CheckAttribs CheckHTML;
|
||||||
* but allow this table to be ADJUSTED if NOT HTML5
|
* but allow this table to be ADJUSTED if NOT HTML5
|
||||||
* was static const Dict tag_defs[] =
|
* was static const Dict tag_defs[] =
|
||||||
\*/
|
\*/
|
||||||
static Dict tag_defs[] =
|
static TIDY_THREAD_LOCAL Dict tag_defs[] =
|
||||||
{
|
{
|
||||||
{ TidyTag_UNKNOWN, "unknown!", VERS_UNKNOWN, NULL, (0), NULL, NULL },
|
{ TidyTag_UNKNOWN, "unknown!", VERS_UNKNOWN, NULL, (0), NULL, NULL },
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue