ReactOS 0.4.16-dev-2208-g6350669
globals.c
Go to the documentation of this file.
1/*
2 * globals.c: definition and handling of the set of global variables
3 * of the library
4 *
5 * See Copyright for the status of this software.
6 *
7 * Gary Pennington <Gary.Pennington@uk.sun.com>
8 * daniel@veillard.com
9 */
10
11#define IN_LIBXML
12#include "libxml.h"
13
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17
18#define XML_GLOBALS_NO_REDEFINITION
19#include <libxml/globals.h>
20#include <libxml/xmlerror.h>
21#include <libxml/xmlmemory.h>
22#include <libxml/xmlIO.h>
23#include <libxml/HTMLparser.h>
24#include <libxml/parser.h>
25#include <libxml/threads.h>
26#include <libxml/tree.h>
27#include <libxml/SAX.h>
28#include <libxml/SAX2.h>
29
30#include "private/error.h"
31#include "private/globals.h"
32#include "private/threads.h"
33#include "private/tree.h"
34
35/*
36 * Thread-local storage emulation.
37 *
38 * This works by replacing a global variable
39 *
40 * extern xmlError xmlLastError;
41 *
42 * with a macro that calls a function returning a pointer to the global in
43 * thread-local storage:
44 *
45 * xmlError *__xmlLastError(void);
46 * #define xmlError (*__xmlLastError());
47 *
48 * The code can operate in a multitude of ways depending on the environment.
49 * First we support POSIX and Windows threads. Then we support both thread-local
50 * storage provided by the compiler and older methods like thread-specific data
51 * (pthreads) or TlsAlloc (Windows).
52 *
53 * To clean up thread-local storage, we use thread-specific data on POSIX.
54 * On Windows, we either use DllMain when compiling a DLL or a registered wait
55 * function for static builds.
56 */
57
58/*
59 * Helpful Macro
60 */
61#ifdef LIBXML_THREAD_ENABLED
62#define IS_MAIN_THREAD (xmlIsMainThreadInternal())
63#else
64#define IS_MAIN_THREAD 1
65#endif
66
67#define XML_DECLARE_MEMBER(name, type, attrs) \
68 type gs_##name;
69
72
73#if defined(HAVE_WIN32_THREADS) && \
74 defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
75 void *threadHandle;
76 void *waitHandle;
77#endif
78
79#define XML_OP XML_DECLARE_MEMBER
85XML_GLOBALS_TREE
86#undef XML_OP
87};
88
90
91/*
92 * Mutex to protect "ForNewThreads" variables
93 */
95
96#ifdef LIBXML_THREAD_ENABLED
97
98/*
99 * On Darwin, thread-local storage destructors seem to be run before
100 * pthread thread-specific data destructors. This causes ASan to
101 * report a use-after-free.
102 *
103 * On Windows, we can't use TLS in static builds. The RegisterWait
104 * callback would run after TLS was deallocated.
105 */
106#if defined(XML_THREAD_LOCAL) && \
107 !defined(__APPLE__) && \
108 (!defined(HAVE_WIN32_THREADS) || \
109 !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
110#define USE_TLS
111#endif
112
113#ifdef USE_TLS
114static XML_THREAD_LOCAL xmlGlobalState globalState;
115#endif
116
117#ifdef HAVE_POSIX_THREADS
118
119/*
120 * Weak symbol hack, see threads.c
121 */
122#if defined(__GNUC__) && \
123 defined(__GLIBC__) && \
124 __GLIBC__ * 100 + __GLIBC_MINOR__ < 234
125
126#pragma weak pthread_getspecific
127#pragma weak pthread_setspecific
128#pragma weak pthread_key_create
129#pragma weak pthread_key_delete
130#pragma weak pthread_equal
131#pragma weak pthread_self
132
133#define XML_PTHREAD_WEAK
134
135static int libxml_is_threaded = -1;
136
137#endif
138
139/*
140 * On POSIX, we need thread-specific data even with thread-local storage
141 * to destroy indirect references from global state (xmlLastError) at
142 * thread exit.
143 */
144static pthread_key_t globalkey;
145static pthread_t mainthread;
146
147#elif defined HAVE_WIN32_THREADS
148
149#ifndef USE_TLS
150static DWORD globalkey = TLS_OUT_OF_INDEXES;
151#endif
152static DWORD mainthread;
153
154#endif /* HAVE_WIN32_THREADS */
155
156static void
157xmlFreeGlobalState(void *state);
158
159#endif /* LIBXML_THREAD_ENABLED */
160
161/************************************************************************
162 * *
163 * All the user accessible global variables of the library *
164 * *
165 ************************************************************************/
166
167/*
168 * Memory allocation routines
169 */
170
171#if defined(DEBUG_MEMORY_LOCATION)
173xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
174xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
177#else
193xmlMallocFunc xmlMalloc = malloc;
204xmlMallocFunc xmlMallocAtomic = malloc;
223static char *
224xmlPosixStrdup(const char *cur) {
225 return((char*) xmlCharStrdup(cur));
226}
236#endif /* DEBUG_MEMORY_LOCATION */
237
246xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
247static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
255int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
256static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
257
258/*
259 * Parser defaults
260 */
261
267int oldXMLWDcompatibility = 0; /* DEPRECATED */
358
364xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
365static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
366
372xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
373static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
374
382
390
420
421#ifdef LIBXML_OUTPUT_ENABLED
422/*
423 * output defaults
424 */
431int xmlIndentTreeOutput = 1;
432static int xmlIndentTreeOutputThrDef = 1;
433
439const char *xmlTreeIndentString = " ";
440static const char *xmlTreeIndentStringThrDef = " ";
441
450int xmlSaveNoEmptyTags = 0;
451static int xmlSaveNoEmptyTagsThrDef = 0;
452#endif /* LIBXML_OUTPUT_ENABLED */
453
454#ifdef LIBXML_SAX1_ENABLED
463xmlSAXHandlerV1 xmlDefaultSAXHandler = {
478 xmlSAX2StartElement,
479 xmlSAX2EndElement,
491 1,
492};
493#endif /* LIBXML_SAX1_ENABLED */
494
503xmlSAXLocator xmlDefaultSAXLocator = {
508};
509
510#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
519xmlSAXHandlerV1 htmlDefaultSAXHandler = {
521 NULL,
522 NULL,
523 NULL,
524 NULL,
526 NULL,
527 NULL,
528 NULL,
529 NULL,
530 NULL,
534 xmlSAX2StartElement,
535 xmlSAX2EndElement,
536 NULL,
544 NULL,
546 NULL,
547 1,
548};
549#endif /* LIBXML_HTML_ENABLED */
550
551/************************************************************************
552 * *
553 * Per thread global state handling *
554 * *
555 ************************************************************************/
556
562void xmlInitGlobals(void) {
564}
565
573
574#ifdef HAVE_POSIX_THREADS
575#ifdef XML_PTHREAD_WEAK
576 if (libxml_is_threaded == -1)
577 libxml_is_threaded =
578 (pthread_getspecific != NULL) &&
579 (pthread_setspecific != NULL) &&
580 (pthread_key_create != NULL) &&
581 (pthread_key_delete != NULL) &&
582 /*
583 * pthread_equal can be inline, resuting in -Waddress warnings.
584 * Let's assume it's available if all the other functions are.
585 */
586 /* (pthread_equal != NULL) && */
587 (pthread_self != NULL);
588 if (libxml_is_threaded == 0)
589 return;
590#endif /* XML_PTHREAD_WEAK */
591 pthread_key_create(&globalkey, xmlFreeGlobalState);
592 mainthread = pthread_self();
593#elif defined(HAVE_WIN32_THREADS)
594#ifndef USE_TLS
595 globalkey = TlsAlloc();
596#endif
597 mainthread = GetCurrentThreadId();
598#endif
599}
600
610}
611
619
621
622#ifdef HAVE_POSIX_THREADS
623#ifdef XML_PTHREAD_WEAK
624 if (libxml_is_threaded == 0)
625 return;
626#endif /* XML_PTHREAD_WEAK */
627 pthread_key_delete(globalkey);
628#elif defined(HAVE_WIN32_THREADS)
629#ifndef USE_TLS
630 if (globalkey != TLS_OUT_OF_INDEXES) {
631 TlsFree(globalkey);
632 globalkey = TLS_OUT_OF_INDEXES;
633 }
634#endif
635#endif
636
638}
639
646void
648{
649}
650
660{
661 return(NULL);
662}
663
664static int
666 if (parserInitialized == 0) {
669 }
670
671#ifdef HAVE_POSIX_THREADS
672#ifdef XML_PTHREAD_WEAK
673 if (libxml_is_threaded == 0)
674 return (1);
675#endif
676 return (pthread_equal(mainthread, pthread_self()));
677#elif defined HAVE_WIN32_THREADS
678 return (mainthread == GetCurrentThreadId());
679#else
680 return (1);
681#endif
682}
683
693int
695 return(xmlIsMainThreadInternal());
696}
697
698#ifdef LIBXML_THREAD_ENABLED
699
700static void
701xmlFreeGlobalState(void *state)
702{
704
705 /*
706 * Free any memory allocated in the thread's xmlLastError. If it
707 * weren't for this indirect allocation, we wouldn't need
708 * a destructor with thread-local storage at all!
709 *
710 * It would be nice if we could make xmlLastError a special error
711 * type which uses statically allocated, fixed-size buffers.
712 * But the xmlError struct is fully public and widely used,
713 * so changes are dangerous.
714 */
715 xmlResetError(&(gs->gs_xmlLastError));
716#ifndef USE_TLS
717 free(state);
718#endif
719}
720
721#if defined(HAVE_WIN32_THREADS) && \
722 defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
723static void WINAPI
724xmlGlobalStateDtor(void *ctxt, unsigned char timedOut ATTRIBUTE_UNUSED) {
725 xmlGlobalStatePtr gs = ctxt;
726
727 UnregisterWait(gs->waitHandle);
728 CloseHandle(gs->threadHandle);
729 xmlFreeGlobalState(gs);
730}
731
732static int
733xmlRegisterGlobalStateDtor(xmlGlobalState *gs) {
734 void *processHandle = GetCurrentProcess();
735 void *threadHandle;
736 void *waitHandle;
737
738 if (DuplicateHandle(processHandle, GetCurrentThread(), processHandle,
739 &threadHandle, 0, FALSE, DUPLICATE_SAME_ACCESS) == 0) {
740 return(-1);
741 }
742
743 if (RegisterWaitForSingleObject(&waitHandle, threadHandle,
744 xmlGlobalStateDtor, gs, INFINITE, WT_EXECUTEONLYONCE) == 0) {
745 CloseHandle(threadHandle);
746 return(-1);
747 }
748
749 gs->threadHandle = threadHandle;
750 gs->waitHandle = waitHandle;
751 return(0);
752}
753#endif /* LIBXML_STATIC */
754
755static void
756xmlInitGlobalState(xmlGlobalStatePtr gs) {
758
759#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
760 inithtmlDefaultSAXHandler(&gs->gs_htmlDefaultSAXHandler);
761#endif
762
763 gs->gs_oldXMLWDcompatibility = 0;
764 gs->gs_xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
765 gs->gs_xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
766#if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
767 initxmlDefaultSAXHandler(&gs->gs_xmlDefaultSAXHandler, 1);
768#endif /* LIBXML_SAX1_ENABLED */
769 gs->gs_xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
770 gs->gs_xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
771 gs->gs_xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
772 gs->gs_xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
773 gs->gs_xmlDoValidityCheckingDefaultValue =
775#ifdef LIBXML_THREAD_ALLOC_ENABLED
776#ifdef DEBUG_MEMORY_LOCATION
777 gs->gs_xmlFree = xmlMemFree;
778 gs->gs_xmlMalloc = xmlMemMalloc;
779 gs->gs_xmlMallocAtomic = xmlMemMalloc;
780 gs->gs_xmlRealloc = xmlMemRealloc;
781 gs->gs_xmlMemStrdup = xmlMemoryStrdup;
782#else
783 gs->gs_xmlFree = free;
784 gs->gs_xmlMalloc = malloc;
785 gs->gs_xmlMallocAtomic = malloc;
786 gs->gs_xmlRealloc = realloc;
787 gs->gs_xmlMemStrdup = xmlPosixStrdup;
788#endif
789#endif
790 gs->gs_xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
791#ifdef LIBXML_OUTPUT_ENABLED
792 gs->gs_xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
793 gs->gs_xmlTreeIndentString = xmlTreeIndentStringThrDef;
794 gs->gs_xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
795#endif
796 gs->gs_xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
797 gs->gs_xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
798 gs->gs_xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
799 gs->gs_xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
800 gs->gs_xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
801 gs->gs_xmlSubstituteEntitiesDefaultValue =
803
804 gs->gs_xmlGenericError = xmlGenericErrorThrDef;
805 gs->gs_xmlStructuredError = xmlStructuredErrorThrDef;
806 gs->gs_xmlGenericErrorContext = xmlGenericErrorContextThrDef;
807 gs->gs_xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
808 gs->gs_xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
809 gs->gs_xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
810
811 gs->gs_xmlParserInputBufferCreateFilenameValue =
813 gs->gs_xmlOutputBufferCreateFilenameValue =
815 memset(&gs->gs_xmlLastError, 0, sizeof(xmlError));
816
818
819#ifdef HAVE_POSIX_THREADS
820 pthread_setspecific(globalkey, gs);
821#elif defined HAVE_WIN32_THREADS
822#ifndef USE_TLS
823 TlsSetValue(globalkey, gs);
824#endif
825#if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
826 xmlRegisterGlobalStateDtor(gs);
827#endif
828#endif
829
830 gs->initialized = 1;
831}
832
833#ifndef USE_TLS
844xmlNewGlobalState(int allowFailure)
845{
847
848 gs = malloc(sizeof(xmlGlobalState));
849 if (gs == NULL) {
850 if (allowFailure)
851 return(NULL);
852
853 /*
854 * If an application didn't call xmlCheckThreadLocalStorage to make
855 * sure that global state could be allocated, it's too late to
856 * handle the error.
857 */
858 fprintf(stderr, "libxml2: Failed to allocate globals for thread\n"
859 "libxml2: See xmlCheckThreadLocalStorage\n");
860 abort();
861 }
862
863 memset(gs, 0, sizeof(xmlGlobalState));
864 xmlInitGlobalState(gs);
865 return (gs);
866}
867#endif
868
870xmlGetThreadLocalStorage(int allowFailure) {
872
873 (void) allowFailure;
874
875#ifdef USE_TLS
876 gs = &globalState;
877 if (gs->initialized == 0)
878 xmlInitGlobalState(gs);
879#elif defined(HAVE_POSIX_THREADS)
880 gs = (xmlGlobalState *) pthread_getspecific(globalkey);
881 if (gs == NULL)
882 gs = xmlNewGlobalState(allowFailure);
883#elif defined(HAVE_WIN32_THREADS)
884 gs = (xmlGlobalState *) TlsGetValue(globalkey);
885 if (gs == NULL)
886 gs = xmlNewGlobalState(allowFailure);
887#else
888 gs = NULL;
889#endif
890
891 return(gs);
892}
893
894/* Define thread-local storage accessors with macro magic */
895
896#define XML_DEFINE_GLOBAL_WRAPPER(name, type, attrs) \
897 type *__##name(void) { \
898 if (IS_MAIN_THREAD) \
899 return (&name); \
900 else \
901 return (&xmlGetThreadLocalStorage(0)->gs_##name); \
902 }
903
904#define XML_OP XML_DEFINE_GLOBAL_WRAPPER
910XML_GLOBALS_TREE
911#undef XML_OP
912
913/* For backward compatibility */
914
915const char *const *
916__xmlParserVersion(void) {
917 return &xmlParserVersion;
918}
919
920#endif /* LIBXML_THREAD_ENABLED */
921
944int
946#if defined(LIBXML_THREAD_ENABLED) && !defined(USE_TLS)
947 if ((!xmlIsMainThreadInternal()) && (xmlGetThreadLocalStorage(1) == NULL))
948 return(-1);
949#endif
950 return(0);
951}
952
964#if defined(HAVE_WIN32_THREADS) && \
965 (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
966#if defined(LIBXML_STATIC_FOR_DLL)
967int
968xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason,
970#else
971/* declare to avoid "no previous prototype for 'DllMain'" warning */
972/* Note that we do NOT want to include this function declaration in
973 a public header because it's meant to be called by Windows itself,
974 not a program that uses this library. This also has to be exported. */
975
977DllMain (HINSTANCE hinstDLL,
980
984#endif
985{
986 switch (fdwReason) {
988#ifdef USE_TLS
989 xmlFreeGlobalState(&globalState);
990#else
991 if (globalkey != TLS_OUT_OF_INDEXES) {
992 xmlGlobalState *globalval;
993
994 globalval = (xmlGlobalState *) TlsGetValue(globalkey);
995 if (globalval) {
996 xmlFreeGlobalState(globalval);
997 TlsSetValue(globalkey, NULL);
998 }
999 }
1000#endif
1001 break;
1002 }
1003 return TRUE;
1004}
1005#endif
1006
1007void
1011 if (handler != NULL)
1013 else
1016}
1017
1018void
1024}
1025
1026xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
1027 xmlBufferAllocationScheme ret;
1032 return ret;
1033}
1034
1036 int ret;
1041 return ret;
1042}
1043
1045 int ret;
1050 return ret;
1051}
1052
1054 int ret;
1059 return ret;
1060}
1061
1062#ifdef LIBXML_OUTPUT_ENABLED
1063int xmlThrDefIndentTreeOutput(int v) {
1064 int ret;
1066 ret = xmlIndentTreeOutputThrDef;
1067 xmlIndentTreeOutputThrDef = v;
1069 return ret;
1070}
1071
1072const char * xmlThrDefTreeIndentString(const char * v) {
1073 const char * ret;
1075 ret = xmlTreeIndentStringThrDef;
1076 xmlTreeIndentStringThrDef = v;
1078 return ret;
1079}
1080
1081int xmlThrDefSaveNoEmptyTags(int v) {
1082 int ret;
1084 ret = xmlSaveNoEmptyTagsThrDef;
1085 xmlSaveNoEmptyTagsThrDef = v;
1087 return ret;
1088}
1089#endif
1090
1092 int ret;
1097 return ret;
1098}
1099
1101 int ret;
1106 return ret;
1107}
1108
1110 int ret;
1115 return ret;
1116}
1117
1119 int ret;
1124 return ret;
1125}
1126
1128 int ret;
1133 return ret;
1134}
1135
1137 int ret;
1142 return ret;
1143}
1144
1145xmlRegisterNodeFunc
1147{
1148 xmlRegisterNodeFunc old;
1149
1152
1156
1157 return(old);
1158}
1159
1160xmlDeregisterNodeFunc
1162{
1163 xmlDeregisterNodeFunc old;
1164
1167
1171
1172 return(old);
1173}
1174
1177{
1179
1182 if (old == NULL) {
1184 }
1185
1188
1189 return(old);
1190}
1191
1194{
1196
1199#ifdef LIBXML_OUTPUT_ENABLED
1200 if (old == NULL) {
1201 old = __xmlOutputBufferCreateFilename;
1202 }
1203#endif
1206
1207 return(old);
1208}
#define XML_GLOBALS_HTML
Definition: HTMLparser.h:339
XMLPUBFUN void xmlSAX2StartDocument(void *ctx)
Definition: SAX2.c:887
XMLPUBFUN void xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
Definition: SAX2.c:588
XMLPUBFUN const xmlChar * xmlSAX2GetPublicId(void *ctx)
XMLPUBFUN void xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
Definition: SAX2.c:813
XMLPUBFUN void xmlSAX2EndDocument(void *ctx)
Definition: SAX2.c:944
XMLPUBFUN xmlEntityPtr xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:564
XMLPUBFUN int xmlSAX2GetLineNumber(void *ctx)
Definition: SAX2.c:243
XMLPUBFUN void xmlSAX2Comment(void *ctx, const xmlChar *value)
Definition: SAX2.c:2614
XMLPUBFUN void xmlSAX2ElementDecl(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)
Definition: SAX2.c:720
XMLPUBFUN void xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
XMLPUBFUN int xmlSAX2HasInternalSubset(void *ctx)
Definition: SAX2.c:291
XMLPUBFUN void xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
Definition: SAX2.c:653
XMLPUBFUN void xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
Definition: SAX2.c:2539
XMLPUBFUN void xmlSAX2NotationDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:764
XMLPUBFUN int xmlSAX2IsStandalone(void *ctx)
Definition: SAX2.c:275
XMLPUBFUN int xmlSAX2GetColumnNumber(void *ctx)
Definition: SAX2.c:259
XMLPUBFUN void xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
Definition: SAX2.c:2660
XMLPUBFUN void xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:357
XMLPUBFUN xmlParserInputPtr xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:486
XMLPUBFUN void xmlSAX2InternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:324
XMLPUBFUN void xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, const xmlChar *data)
Definition: SAX2.c:2567
XMLPUBFUN const xmlChar * xmlSAX2GetSystemId(void *ctx)
Definition: SAX2.c:227
XMLPUBFUN void xmlSAX2Reference(void *ctx, const xmlChar *name)
Definition: SAX2.c:2379
XMLPUBFUN void xmlSAX2SetDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
XMLPUBFUN int xmlSAX2HasExternalSubset(void *ctx)
Definition: SAX2.c:307
XMLPUBFUN xmlEntityPtr xmlSAX2GetEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:518
static DWORD const fdwReason
static int state
Definition: maze.c:121
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
DWORD WINAPI DECLSPEC_HOTPATCH TlsAlloc(void)
Definition: thread.c:657
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
int WINAPIV fprintf(FILE *file, const char *format,...)
Definition: file.c:5549
#define stderr
return ret
Definition: mutex.c:146
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxCollectionEntry * cur
const GLdouble * v
Definition: gl.h:2040
GLenum func
Definition: glext.h:6028
#define ATTRIBUTE_UNUSED
Definition: i386-dis.c:36
#define gs
Definition: i386-dis.c:445
#define abort()
Definition: i386-dis.c:34
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: indicdll.c:224
XMLPUBFUN void xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:201
XMLPUBFUN void xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:225
static IN DWORD IN LPVOID lpvReserved
XML_HIDDEN void xmlCleanupMutex(xmlMutexPtr mutex)
Definition: threads.c:166
XML_HIDDEN void xmlInitMutex(xmlMutexPtr mutex)
Definition: threads.c:128
void xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg,...)
Definition: error.c:70
int xmlThrDefKeepBlanksDefaultValue(int v)
Definition: globals.c:1091
int xmlSubstituteEntitiesDefaultValue
Definition: globals.c:356
void * xmlGenericErrorContext
Definition: globals.c:410
static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef
Definition: globals.c:381
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue
Definition: globals.c:380
xmlReallocFunc xmlRealloc
Definition: globals.c:214
int xmlThrDefDoValidityCheckingDefaultValue(int v)
Definition: globals.c:1044
static int xmlLineNumbersDefaultValueThrDef
Definition: globals.c:331
static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef
Definition: globals.c:365
static char * xmlPosixStrdup(const char *cur)
Definition: globals.c:224
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue
Definition: globals.c:364
xmlFreeFunc xmlFree
Definition: globals.c:184
int xmlThrDefParserDebugEntities(int v)
Definition: globals.c:1118
int xmlCheckThreadLocalStorage(void)
Definition: globals.c:945
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue
Definition: globals.c:388
int xmlThrDefPedanticParserDefaultValue(int v)
Definition: globals.c:1127
xmlGenericErrorFunc xmlGenericError
Definition: globals.c:396
void xmlInitializeGlobalState(xmlGlobalStatePtr gs ATTRIBUTE_UNUSED)
Definition: globals.c:647
static int xmlGetWarningsDefaultValueThrDef
Definition: globals.c:298
xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v)
Definition: globals.c:1026
xmlError xmlLastError
Definition: globals.c:419
static xmlStructuredErrorFunc xmlStructuredErrorThrDef
Definition: globals.c:404
static int parserInitialized
Definition: globals.c:89
void xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler)
Definition: globals.c:1008
static void * xmlGenericErrorContextThrDef
Definition: globals.c:411
int xmlThrDefLoadExtDtdDefaultValue(int v)
Definition: globals.c:1109
int xmlParserDebugEntities
Definition: globals.c:277
static int xmlIsMainThreadInternal(void)
Definition: globals.c:665
static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef
Definition: globals.c:389
xmlOutputBufferCreateFilenameFunc xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
Definition: globals.c:1193
static int xmlSubstituteEntitiesDefaultValueThrDef
Definition: globals.c:357
void * xmlStructuredErrorContext
Definition: globals.c:417
int oldXMLWDcompatibility
Definition: globals.c:267
static int xmlKeepBlanksDefaultValueThrDef
Definition: globals.c:344
static void * xmlStructuredErrorContextThrDef
Definition: globals.c:418
xmlParserInputBufferCreateFilenameFunc xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
Definition: globals.c:1176
void xmlInitGlobals(void)
Definition: globals.c:562
static int xmlParserDebugEntitiesThrDef
Definition: globals.c:278
int xmlLoadExtDtdDefaultValue
Definition: globals.c:308
int xmlThrDefGetWarningsDefaultValue(int v)
Definition: globals.c:1053
void xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler)
Definition: globals.c:1019
void xmlCleanupGlobals(void)
Definition: globals.c:609
xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
Definition: globals.c:1146
xmlMallocFunc xmlMalloc
Definition: globals.c:193
xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
Definition: globals.c:1161
xmlStructuredErrorFunc xmlStructuredError
Definition: globals.c:403
static int xmlDefaultBufferSizeThrDef
Definition: globals.c:256
int xmlThrDefLineNumbersDefaultValue(int v)
Definition: globals.c:1100
int xmlIsMainThread(void)
Definition: globals.c:694
static int xmlLoadExtDtdDefaultValueThrDef
Definition: globals.c:309
static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef
Definition: globals.c:373
int xmlDefaultBufferSize
Definition: globals.c:255
static int xmlDoValidityCheckingDefaultValueThrDef
Definition: globals.c:288
void xmlInitGlobalsInternal(void)
Definition: globals.c:571
static xmlMutex xmlThrDefMutex
Definition: globals.c:94
xmlSAXLocator xmlDefaultSAXLocator
Definition: globals.c:503
void xmlCleanupGlobalsInternal(void)
Definition: globals.c:617
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue
Definition: globals.c:372
int xmlThrDefDefaultBufferSize(int v)
Definition: globals.c:1035
static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef
Definition: globals.c:247
int xmlDoValidityCheckingDefaultValue
Definition: globals.c:287
xmlMallocFunc xmlMallocAtomic
Definition: globals.c:204
int xmlKeepBlanksDefaultValue
Definition: globals.c:343
static int xmlPedanticParserDefaultValueThrDef
Definition: globals.c:319
int xmlThrDefSubstituteEntitiesDefaultValue(int v)
Definition: globals.c:1136
xmlStrdupFunc xmlMemStrdup
Definition: globals.c:235
int xmlPedanticParserDefaultValue
Definition: globals.c:318
int xmlGetWarningsDefaultValue
Definition: globals.c:297
xmlGlobalStatePtr xmlGetGlobalState(void)
Definition: globals.c:659
static xmlGenericErrorFunc xmlGenericErrorThrDef
Definition: globals.c:397
int xmlLineNumbersDefaultValue
Definition: globals.c:330
xmlBufferAllocationScheme xmlBufferAllocScheme
Definition: globals.c:246
XMLPUBVAR const char *const xmlParserVersion
Definition: parser.h:845
XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser(void)
Definition: threads.c:569
#define XML_GLOBALS_PARSER
Definition: parser.h:880
XML_HIDDEN int __xmlRegisterCallbacks
Definition: tree.c:50
#define memset(x, y, z)
Definition: compat.h:39
int initialized
Definition: globals.c:71
BOOL WINAPI RegisterWaitForSingleObject(OUT PHANDLE phNewWaitObject, IN HANDLE hObject, IN WAITORTIMERCALLBACK Callback, IN PVOID Context, IN ULONG dwMilliseconds, IN ULONG dwFlags)
Definition: synch.c:850
BOOL WINAPI UnregisterWait(IN HANDLE WaitHandle)
Definition: synch.c:934
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1148
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:529
#define WINAPI
Definition: msvc.h:6
#define WT_EXECUTEONLYONCE
Definition: winnt_old.h:1096
#define DUPLICATE_SAME_ACCESS
xmlParserInputBufferPtr(* xmlParserInputBufferCreateFilenameFunc)(const char *URI, xmlCharEncoding enc)
Definition: xmlIO.h:129
#define XML_GLOBALS_IO
Definition: xmlIO.h:177
xmlOutputBufferPtr(* xmlOutputBufferCreateFilenameFunc)(const char *URI, xmlCharEncodingHandlerPtr encoder, int compression)
Definition: xmlIO.h:143
xmlParserInputBufferPtr __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc)
XMLPUBFUN void xmlParserError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
XMLPUBFUN void xmlResetError(xmlErrorPtr err)
void(*) typedef void(* xmlStructuredErrorFunc)(void *userData, const xmlError *error)
Definition: xmlerror.h:859
#define XML_GLOBALS_ERROR
Definition: xmlerror.h:862
XMLPUBFUN void XMLPUBFUN void xmlParserWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
void(* xmlGenericErrorFunc)(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
Definition: xmlerror.h:848
#define XMLPUBFUN
Definition: xmlexports.h:30
XMLPUBFUN char * xmlMemoryStrdup(const char *str)
Definition: xmlmemory.c:510
void *(* xmlReallocFunc)(void *mem, size_t size)
Definition: xmlmemory.h:51
XMLPUBFUN void xmlMemFree(void *ptr)
Definition: xmlmemory.c:381
XMLPUBFUN void * xmlMemRealloc(void *ptr, size_t size)
Definition: xmlmemory.c:370
#define XML_GLOBALS_ALLOC
Definition: xmlmemory.h:91
char *(* xmlStrdupFunc)(const char *str)
Definition: xmlmemory.h:61
XMLPUBFUN void * xmlMemMalloc(size_t size) LIBXML_ATTR_ALLOC_SIZE(1)
Definition: xmlmemory.c:272
void(* xmlFreeFunc)(void *mem)
Definition: xmlmemory.h:31
XMLPUBFUN xmlChar * xmlCharStrdup(const char *cur)
Definition: xmlstring.c:116