1 | /*
|
---|
2 | * globals.c: definition and handling of the set of global variables
|
---|
3 | * of the library
|
---|
4 | *
|
---|
5 | * The bottom of this file is automatically generated by build_glob.py
|
---|
6 | * based on the description file global.data
|
---|
7 | *
|
---|
8 | * See Copyright for the status of this software.
|
---|
9 | *
|
---|
10 | * Gary Pennington <[email protected]>
|
---|
11 | * [email protected]
|
---|
12 | */
|
---|
13 |
|
---|
14 | #define IN_LIBXML
|
---|
15 | #include "libxml.h"
|
---|
16 |
|
---|
17 | #ifdef HAVE_STDLIB_H
|
---|
18 | #include <stdlib.h>
|
---|
19 | #endif
|
---|
20 | #include <string.h>
|
---|
21 |
|
---|
22 | #include <libxml/globals.h>
|
---|
23 | #include <libxml/xmlmemory.h>
|
---|
24 | #include <libxml/threads.h>
|
---|
25 |
|
---|
26 | /* #define DEBUG_GLOBALS */
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Helpful Macro
|
---|
30 | */
|
---|
31 | #ifdef LIBXML_THREAD_ENABLED
|
---|
32 | #define IS_MAIN_THREAD (xmlIsMainThread())
|
---|
33 | #else
|
---|
34 | #define IS_MAIN_THREAD 1
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | /*
|
---|
38 | * Mutex to protect "ForNewThreads" variables
|
---|
39 | */
|
---|
40 | static xmlMutexPtr xmlThrDefMutex = NULL;
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * xmlInitGlobals:
|
---|
44 | *
|
---|
45 | * Additional initialisation for multi-threading
|
---|
46 | */
|
---|
47 | void xmlInitGlobals(void)
|
---|
48 | {
|
---|
49 | if (xmlThrDefMutex == NULL)
|
---|
50 | xmlThrDefMutex = xmlNewMutex();
|
---|
51 | }
|
---|
52 |
|
---|
53 | /************************************************************************
|
---|
54 | * *
|
---|
55 | * All the user accessible global variables of the library *
|
---|
56 | * *
|
---|
57 | ************************************************************************/
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * Memory allocation routines
|
---|
61 | */
|
---|
62 | #undef xmlFree
|
---|
63 | #undef xmlMalloc
|
---|
64 | #undef xmlMallocAtomic
|
---|
65 | #undef xmlMemStrdup
|
---|
66 | #undef xmlRealloc
|
---|
67 |
|
---|
68 | #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY)
|
---|
69 | xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree;
|
---|
70 | xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
|
---|
71 | xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
|
---|
72 | xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
|
---|
73 | xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
|
---|
74 | #else
|
---|
75 | /**
|
---|
76 | * xmlFree:
|
---|
77 | * @mem: an already allocated block of memory
|
---|
78 | *
|
---|
79 | * The variable holding the libxml free() implementation
|
---|
80 | */
|
---|
81 | xmlFreeFunc xmlFree = free;
|
---|
82 | /**
|
---|
83 | * xmlMalloc:
|
---|
84 | * @size: the size requested in bytes
|
---|
85 | *
|
---|
86 | * The variable holding the libxml malloc() implementation
|
---|
87 | *
|
---|
88 | * Returns a pointer to the newly allocated block or NULL in case of error
|
---|
89 | */
|
---|
90 | xmlMallocFunc xmlMalloc = malloc;
|
---|
91 | /**
|
---|
92 | * xmlMallocAtomic:
|
---|
93 | * @size: the size requested in bytes
|
---|
94 | *
|
---|
95 | * The variable holding the libxml malloc() implementation for atomic
|
---|
96 | * data (i.e. blocks not containing pointers), useful when using a
|
---|
97 | * garbage collecting allocator.
|
---|
98 | *
|
---|
99 | * Returns a pointer to the newly allocated block or NULL in case of error
|
---|
100 | */
|
---|
101 | xmlMallocFunc xmlMallocAtomic = malloc;
|
---|
102 | /**
|
---|
103 | * xmlRealloc:
|
---|
104 | * @mem: an already allocated block of memory
|
---|
105 | * @size: the new size requested in bytes
|
---|
106 | *
|
---|
107 | * The variable holding the libxml realloc() implementation
|
---|
108 | *
|
---|
109 | * Returns a pointer to the newly reallocated block or NULL in case of error
|
---|
110 | */
|
---|
111 | xmlReallocFunc xmlRealloc = realloc;
|
---|
112 | /**
|
---|
113 | * xmlPosixStrdup
|
---|
114 | * @cur: the input char *
|
---|
115 | *
|
---|
116 | * a strdup implementation with a type signature matching POSIX
|
---|
117 | *
|
---|
118 | * Returns a new xmlChar * or NULL
|
---|
119 | */
|
---|
120 | static char *
|
---|
121 | xmlPosixStrdup(const char *cur) {
|
---|
122 | return((char*) xmlCharStrdup(cur));
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * xmlMemStrdup:
|
---|
126 | * @str: a zero terminated string
|
---|
127 | *
|
---|
128 | * The variable holding the libxml strdup() implementation
|
---|
129 | *
|
---|
130 | * Returns the copy of the string or NULL in case of error
|
---|
131 | */
|
---|
132 | xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
|
---|
133 | #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
|
---|
134 |
|
---|
135 | #include <libxml/threads.h>
|
---|
136 | #include <libxml/globals.h>
|
---|
137 | #include <libxml/SAX.h>
|
---|
138 |
|
---|
139 | #undef docbDefaultSAXHandler
|
---|
140 | #undef htmlDefaultSAXHandler
|
---|
141 | #undef oldXMLWDcompatibility
|
---|
142 | #undef xmlBufferAllocScheme
|
---|
143 | #undef xmlDefaultBufferSize
|
---|
144 | #undef xmlDefaultSAXHandler
|
---|
145 | #undef xmlDefaultSAXLocator
|
---|
146 | #undef xmlDoValidityCheckingDefaultValue
|
---|
147 | #undef xmlGenericError
|
---|
148 | #undef xmlStructuredError
|
---|
149 | #undef xmlGenericErrorContext
|
---|
150 | #undef xmlStructuredErrorContext
|
---|
151 | #undef xmlGetWarningsDefaultValue
|
---|
152 | #undef xmlIndentTreeOutput
|
---|
153 | #undef xmlTreeIndentString
|
---|
154 | #undef xmlKeepBlanksDefaultValue
|
---|
155 | #undef xmlLineNumbersDefaultValue
|
---|
156 | #undef xmlLoadExtDtdDefaultValue
|
---|
157 | #undef xmlParserDebugEntities
|
---|
158 | #undef xmlParserVersion
|
---|
159 | #undef xmlPedanticParserDefaultValue
|
---|
160 | #undef xmlSaveNoEmptyTags
|
---|
161 | #undef xmlSubstituteEntitiesDefaultValue
|
---|
162 | #undef xmlRegisterNodeDefaultValue
|
---|
163 | #undef xmlDeregisterNodeDefaultValue
|
---|
164 | #undef xmlLastError
|
---|
165 |
|
---|
166 | #undef xmlParserInputBufferCreateFilenameValue
|
---|
167 | #undef xmlOutputBufferCreateFilenameValue
|
---|
168 | /**
|
---|
169 | * xmlParserVersion:
|
---|
170 | *
|
---|
171 | * Constant string describing the internal version of the library
|
---|
172 | */
|
---|
173 | const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * xmlBufferAllocScheme:
|
---|
177 | *
|
---|
178 | * Global setting, default allocation policy for buffers, default is
|
---|
179 | * XML_BUFFER_ALLOC_EXACT
|
---|
180 | */
|
---|
181 | xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
|
---|
182 | static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT;
|
---|
183 | /**
|
---|
184 | * xmlDefaultBufferSize:
|
---|
185 | *
|
---|
186 | * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
|
---|
187 | */
|
---|
188 | int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
|
---|
189 | static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE;
|
---|
190 |
|
---|
191 | /*
|
---|
192 | * Parser defaults
|
---|
193 | */
|
---|
194 |
|
---|
195 | /**
|
---|
196 | * oldXMLWDcompatibility:
|
---|
197 | *
|
---|
198 | * Global setting, DEPRECATED.
|
---|
199 | */
|
---|
200 | int oldXMLWDcompatibility = 0; /* DEPRECATED */
|
---|
201 | /**
|
---|
202 | * xmlParserDebugEntities:
|
---|
203 | *
|
---|
204 | * Global setting, asking the parser to print out debugging information.
|
---|
205 | * while handling entities.
|
---|
206 | * Disabled by default
|
---|
207 | */
|
---|
208 | int xmlParserDebugEntities = 0;
|
---|
209 | static int xmlParserDebugEntitiesThrDef = 0;
|
---|
210 | /**
|
---|
211 | * xmlDoValidityCheckingDefaultValue:
|
---|
212 | *
|
---|
213 | * Global setting, indicate that the parser should work in validating mode.
|
---|
214 | * Disabled by default.
|
---|
215 | */
|
---|
216 | int xmlDoValidityCheckingDefaultValue = 0;
|
---|
217 | static int xmlDoValidityCheckingDefaultValueThrDef = 0;
|
---|
218 | /**
|
---|
219 | * xmlGetWarningsDefaultValue:
|
---|
220 | *
|
---|
221 | * Global setting, indicate that the parser should provide warnings.
|
---|
222 | * Activated by default.
|
---|
223 | */
|
---|
224 | int xmlGetWarningsDefaultValue = 1;
|
---|
225 | static int xmlGetWarningsDefaultValueThrDef = 1;
|
---|
226 | /**
|
---|
227 | * xmlLoadExtDtdDefaultValue:
|
---|
228 | *
|
---|
229 | * Global setting, indicate that the parser should load DTD while not
|
---|
230 | * validating.
|
---|
231 | * Disabled by default.
|
---|
232 | */
|
---|
233 | int xmlLoadExtDtdDefaultValue = 0;
|
---|
234 | static int xmlLoadExtDtdDefaultValueThrDef = 0;
|
---|
235 | /**
|
---|
236 | * xmlPedanticParserDefaultValue:
|
---|
237 | *
|
---|
238 | * Global setting, indicate that the parser be pedantic
|
---|
239 | * Disabled by default.
|
---|
240 | */
|
---|
241 | int xmlPedanticParserDefaultValue = 0;
|
---|
242 | static int xmlPedanticParserDefaultValueThrDef = 0;
|
---|
243 | /**
|
---|
244 | * xmlLineNumbersDefaultValue:
|
---|
245 | *
|
---|
246 | * Global setting, indicate that the parser should store the line number
|
---|
247 | * in the content field of elements in the DOM tree.
|
---|
248 | * Disabled by default since this may not be safe for old classes of
|
---|
249 | * application.
|
---|
250 | */
|
---|
251 | int xmlLineNumbersDefaultValue = 0;
|
---|
252 | static int xmlLineNumbersDefaultValueThrDef = 0;
|
---|
253 | /**
|
---|
254 | * xmlKeepBlanksDefaultValue:
|
---|
255 | *
|
---|
256 | * Global setting, indicate that the parser should keep all blanks
|
---|
257 | * nodes found in the content
|
---|
258 | * Activated by default, this is actually needed to have the parser
|
---|
259 | * conformant to the XML Recommendation, however the option is kept
|
---|
260 | * for some applications since this was libxml1 default behaviour.
|
---|
261 | */
|
---|
262 | int xmlKeepBlanksDefaultValue = 1;
|
---|
263 | static int xmlKeepBlanksDefaultValueThrDef = 1;
|
---|
264 | /**
|
---|
265 | * xmlSubstituteEntitiesDefaultValue:
|
---|
266 | *
|
---|
267 | * Global setting, indicate that the parser should not generate entity
|
---|
268 | * references but replace them with the actual content of the entity
|
---|
269 | * Disabled by default, this should be activated when using XPath since
|
---|
270 | * the XPath data model requires entities replacement and the XPath
|
---|
271 | * engine does not handle entities references transparently.
|
---|
272 | */
|
---|
273 | int xmlSubstituteEntitiesDefaultValue = 0;
|
---|
274 | static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
|
---|
275 |
|
---|
276 | xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
|
---|
277 | static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
|
---|
278 | xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
|
---|
279 | static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
|
---|
280 |
|
---|
281 | xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
|
---|
282 | static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
|
---|
283 |
|
---|
284 | xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
|
---|
285 | static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
|
---|
286 |
|
---|
287 | /*
|
---|
288 | * Error handling
|
---|
289 | */
|
---|
290 |
|
---|
291 | /* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
|
---|
292 | /* Must initialize xmlGenericError in xmlInitParser */
|
---|
293 | void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
|
---|
294 | const char *msg,
|
---|
295 | ...);
|
---|
296 | /**
|
---|
297 | * xmlGenericError:
|
---|
298 | *
|
---|
299 | * Global setting: function used for generic error callbacks
|
---|
300 | */
|
---|
301 | xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc;
|
---|
302 | static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
|
---|
303 | /**
|
---|
304 | * xmlStructuredError:
|
---|
305 | *
|
---|
306 | * Global setting: function used for structured error callbacks
|
---|
307 | */
|
---|
308 | xmlStructuredErrorFunc xmlStructuredError = NULL;
|
---|
309 | static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
|
---|
310 | /**
|
---|
311 | * xmlGenericErrorContext:
|
---|
312 | *
|
---|
313 | * Global setting passed to generic error callbacks
|
---|
314 | */
|
---|
315 | void *xmlGenericErrorContext = NULL;
|
---|
316 | static void *xmlGenericErrorContextThrDef = NULL;
|
---|
317 | /**
|
---|
318 | * xmlStructuredErrorContext:
|
---|
319 | *
|
---|
320 | * Global setting passed to structured error callbacks
|
---|
321 | */
|
---|
322 | void *xmlStructuredErrorContext = NULL;
|
---|
323 | static void *xmlStructuredErrorContextThrDef = NULL;
|
---|
324 | xmlError xmlLastError;
|
---|
325 |
|
---|
326 | /*
|
---|
327 | * output defaults
|
---|
328 | */
|
---|
329 | /**
|
---|
330 | * xmlIndentTreeOutput:
|
---|
331 | *
|
---|
332 | * Global setting, asking the serializer to indent the output tree by default
|
---|
333 | * Enabled by default
|
---|
334 | */
|
---|
335 | int xmlIndentTreeOutput = 1;
|
---|
336 | static int xmlIndentTreeOutputThrDef = 1;
|
---|
337 |
|
---|
338 | /**
|
---|
339 | * xmlTreeIndentString:
|
---|
340 | *
|
---|
341 | * The string used to do one-level indent. By default is equal to " " (two spaces)
|
---|
342 | */
|
---|
343 | const char *xmlTreeIndentString = " ";
|
---|
344 | static const char *xmlTreeIndentStringThrDef = " ";
|
---|
345 |
|
---|
346 | /**
|
---|
347 | * xmlSaveNoEmptyTags:
|
---|
348 | *
|
---|
349 | * Global setting, asking the serializer to not output empty tags
|
---|
350 | * as <empty/> but <empty></empty>. those two forms are indistinguishable
|
---|
351 | * once parsed.
|
---|
352 | * Disabled by default
|
---|
353 | */
|
---|
354 | int xmlSaveNoEmptyTags = 0;
|
---|
355 | static int xmlSaveNoEmptyTagsThrDef = 0;
|
---|
356 |
|
---|
357 | #ifdef LIBXML_SAX1_ENABLED
|
---|
358 | /**
|
---|
359 | * xmlDefaultSAXHandler:
|
---|
360 | *
|
---|
361 | * Default SAX version1 handler for XML, builds the DOM tree
|
---|
362 | */
|
---|
363 | xmlSAXHandlerV1 xmlDefaultSAXHandler = {
|
---|
364 | xmlSAX2InternalSubset,
|
---|
365 | xmlSAX2IsStandalone,
|
---|
366 | xmlSAX2HasInternalSubset,
|
---|
367 | xmlSAX2HasExternalSubset,
|
---|
368 | xmlSAX2ResolveEntity,
|
---|
369 | xmlSAX2GetEntity,
|
---|
370 | xmlSAX2EntityDecl,
|
---|
371 | xmlSAX2NotationDecl,
|
---|
372 | xmlSAX2AttributeDecl,
|
---|
373 | xmlSAX2ElementDecl,
|
---|
374 | xmlSAX2UnparsedEntityDecl,
|
---|
375 | xmlSAX2SetDocumentLocator,
|
---|
376 | xmlSAX2StartDocument,
|
---|
377 | xmlSAX2EndDocument,
|
---|
378 | xmlSAX2StartElement,
|
---|
379 | xmlSAX2EndElement,
|
---|
380 | xmlSAX2Reference,
|
---|
381 | xmlSAX2Characters,
|
---|
382 | xmlSAX2Characters,
|
---|
383 | xmlSAX2ProcessingInstruction,
|
---|
384 | xmlSAX2Comment,
|
---|
385 | xmlParserWarning,
|
---|
386 | xmlParserError,
|
---|
387 | xmlParserError,
|
---|
388 | xmlSAX2GetParameterEntity,
|
---|
389 | xmlSAX2CDataBlock,
|
---|
390 | xmlSAX2ExternalSubset,
|
---|
391 | 0,
|
---|
392 | };
|
---|
393 | #endif /* LIBXML_SAX1_ENABLED */
|
---|
394 |
|
---|
395 | /**
|
---|
396 | * xmlDefaultSAXLocator:
|
---|
397 | *
|
---|
398 | * The default SAX Locator
|
---|
399 | * { getPublicId, getSystemId, getLineNumber, getColumnNumber}
|
---|
400 | */
|
---|
401 | xmlSAXLocator xmlDefaultSAXLocator = {
|
---|
402 | xmlSAX2GetPublicId,
|
---|
403 | xmlSAX2GetSystemId,
|
---|
404 | xmlSAX2GetLineNumber,
|
---|
405 | xmlSAX2GetColumnNumber
|
---|
406 | };
|
---|
407 |
|
---|
408 | #ifdef LIBXML_HTML_ENABLED
|
---|
409 | /**
|
---|
410 | * htmlDefaultSAXHandler:
|
---|
411 | *
|
---|
412 | * Default old SAX v1 handler for HTML, builds the DOM tree
|
---|
413 | */
|
---|
414 | xmlSAXHandlerV1 htmlDefaultSAXHandler = {
|
---|
415 | xmlSAX2InternalSubset,
|
---|
416 | NULL,
|
---|
417 | NULL,
|
---|
418 | NULL,
|
---|
419 | NULL,
|
---|
420 | xmlSAX2GetEntity,
|
---|
421 | NULL,
|
---|
422 | NULL,
|
---|
423 | NULL,
|
---|
424 | NULL,
|
---|
425 | NULL,
|
---|
426 | xmlSAX2SetDocumentLocator,
|
---|
427 | xmlSAX2StartDocument,
|
---|
428 | xmlSAX2EndDocument,
|
---|
429 | xmlSAX2StartElement,
|
---|
430 | xmlSAX2EndElement,
|
---|
431 | NULL,
|
---|
432 | xmlSAX2Characters,
|
---|
433 | xmlSAX2IgnorableWhitespace,
|
---|
434 | xmlSAX2ProcessingInstruction,
|
---|
435 | xmlSAX2Comment,
|
---|
436 | xmlParserWarning,
|
---|
437 | xmlParserError,
|
---|
438 | xmlParserError,
|
---|
439 | xmlSAX2GetParameterEntity,
|
---|
440 | xmlSAX2CDataBlock,
|
---|
441 | NULL,
|
---|
442 | 0,
|
---|
443 | };
|
---|
444 | #endif /* LIBXML_HTML_ENABLED */
|
---|
445 |
|
---|
446 | #ifdef LIBXML_DOCB_ENABLED
|
---|
447 | /**
|
---|
448 | * docbDefaultSAXHandler:
|
---|
449 | *
|
---|
450 | * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
|
---|
451 | */
|
---|
452 | xmlSAXHandlerV1 docbDefaultSAXHandler = {
|
---|
453 | xmlSAX2InternalSubset,
|
---|
454 | xmlSAX2IsStandalone,
|
---|
455 | xmlSAX2HasInternalSubset,
|
---|
456 | xmlSAX2HasExternalSubset,
|
---|
457 | xmlSAX2ResolveEntity,
|
---|
458 | xmlSAX2GetEntity,
|
---|
459 | xmlSAX2EntityDecl,
|
---|
460 | NULL,
|
---|
461 | NULL,
|
---|
462 | NULL,
|
---|
463 | NULL,
|
---|
464 | xmlSAX2SetDocumentLocator,
|
---|
465 | xmlSAX2StartDocument,
|
---|
466 | xmlSAX2EndDocument,
|
---|
467 | xmlSAX2StartElement,
|
---|
468 | xmlSAX2EndElement,
|
---|
469 | xmlSAX2Reference,
|
---|
470 | xmlSAX2Characters,
|
---|
471 | xmlSAX2IgnorableWhitespace,
|
---|
472 | NULL,
|
---|
473 | xmlSAX2Comment,
|
---|
474 | xmlParserWarning,
|
---|
475 | xmlParserError,
|
---|
476 | xmlParserError,
|
---|
477 | xmlSAX2GetParameterEntity,
|
---|
478 | NULL,
|
---|
479 | NULL,
|
---|
480 | 0,
|
---|
481 | };
|
---|
482 | #endif /* LIBXML_DOCB_ENABLED */
|
---|
483 |
|
---|
484 | /**
|
---|
485 | * xmlInitializeGlobalState:
|
---|
486 | * @gs: a pointer to a newly allocated global state
|
---|
487 | *
|
---|
488 | * xmlInitializeGlobalState() initialize a global state with all the
|
---|
489 | * default values of the library.
|
---|
490 | */
|
---|
491 | void
|
---|
492 | xmlInitializeGlobalState(xmlGlobalStatePtr gs)
|
---|
493 | {
|
---|
494 | #ifdef DEBUG_GLOBALS
|
---|
495 | fprintf(stderr, "Initializing globals at %lu for thread %d\n",
|
---|
496 | (unsigned long) gs, xmlGetThreadId());
|
---|
497 | #endif
|
---|
498 |
|
---|
499 | /*
|
---|
500 | * Perform initialization as required by libxml
|
---|
501 | */
|
---|
502 | if (xmlThrDefMutex == NULL)
|
---|
503 | xmlInitGlobals();
|
---|
504 |
|
---|
505 | xmlMutexLock(xmlThrDefMutex);
|
---|
506 |
|
---|
507 | #if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
|
---|
508 | initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
|
---|
509 | #endif
|
---|
510 | #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
|
---|
511 | inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
|
---|
512 | #endif
|
---|
513 |
|
---|
514 | gs->oldXMLWDcompatibility = 0;
|
---|
515 | gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
|
---|
516 | gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
|
---|
517 | #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
|
---|
518 | initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
|
---|
519 | #endif /* LIBXML_SAX1_ENABLED */
|
---|
520 | gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
|
---|
521 | gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
|
---|
522 | gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
|
---|
523 | gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
|
---|
524 | gs->xmlDoValidityCheckingDefaultValue =
|
---|
525 | xmlDoValidityCheckingDefaultValueThrDef;
|
---|
526 | #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
|
---|
527 | gs->xmlFree = (xmlFreeFunc) xmlMemFree;
|
---|
528 | gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
|
---|
529 | gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
|
---|
530 | gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
|
---|
531 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
|
---|
532 | #else
|
---|
533 | gs->xmlFree = (xmlFreeFunc) free;
|
---|
534 | gs->xmlMalloc = (xmlMallocFunc) malloc;
|
---|
535 | gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
|
---|
536 | gs->xmlRealloc = (xmlReallocFunc) realloc;
|
---|
537 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
|
---|
538 | #endif
|
---|
539 | gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
|
---|
540 | gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
|
---|
541 | gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
|
---|
542 | gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
|
---|
543 | gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
|
---|
544 | gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
|
---|
545 | gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
|
---|
546 | gs->xmlParserVersion = LIBXML_VERSION_STRING;
|
---|
547 | gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
|
---|
548 | gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
|
---|
549 | gs->xmlSubstituteEntitiesDefaultValue =
|
---|
550 | xmlSubstituteEntitiesDefaultValueThrDef;
|
---|
551 |
|
---|
552 | gs->xmlGenericError = xmlGenericErrorThrDef;
|
---|
553 | gs->xmlStructuredError = xmlStructuredErrorThrDef;
|
---|
554 | gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
|
---|
555 | gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
|
---|
556 | gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
|
---|
557 | gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
|
---|
558 |
|
---|
559 | gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
|
---|
560 | gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
|
---|
561 | memset(&gs->xmlLastError, 0, sizeof(xmlError));
|
---|
562 |
|
---|
563 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
564 | }
|
---|
565 |
|
---|
566 | /**
|
---|
567 | * xmlCleanupGlobals:
|
---|
568 | *
|
---|
569 | * Additional cleanup for multi-threading
|
---|
570 | */
|
---|
571 | void xmlCleanupGlobals(void)
|
---|
572 | {
|
---|
573 | xmlResetError(&xmlLastError);
|
---|
574 |
|
---|
575 | if (xmlThrDefMutex != NULL) {
|
---|
576 | xmlFreeMutex(xmlThrDefMutex);
|
---|
577 | xmlThrDefMutex = NULL;
|
---|
578 | }
|
---|
579 | __xmlGlobalInitMutexDestroy();
|
---|
580 | }
|
---|
581 |
|
---|
582 | /**
|
---|
583 | * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
|
---|
584 | * those are really internal work
|
---|
585 | */
|
---|
586 | void
|
---|
587 | xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
|
---|
588 | xmlMutexLock(xmlThrDefMutex);
|
---|
589 | xmlGenericErrorContextThrDef = ctx;
|
---|
590 | if (handler != NULL)
|
---|
591 | xmlGenericErrorThrDef = handler;
|
---|
592 | else
|
---|
593 | xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
|
---|
594 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
595 | }
|
---|
596 |
|
---|
597 | void
|
---|
598 | xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
|
---|
599 | xmlMutexLock(xmlThrDefMutex);
|
---|
600 | xmlStructuredErrorContextThrDef = ctx;
|
---|
601 | xmlStructuredErrorThrDef = handler;
|
---|
602 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
603 | }
|
---|
604 |
|
---|
605 | /**
|
---|
606 | * xmlRegisterNodeDefault:
|
---|
607 | * @func: function pointer to the new RegisterNodeFunc
|
---|
608 | *
|
---|
609 | * Registers a callback for node creation
|
---|
610 | *
|
---|
611 | * Returns the old value of the registration function
|
---|
612 | */
|
---|
613 | xmlRegisterNodeFunc
|
---|
614 | xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
|
---|
615 | {
|
---|
616 | xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
|
---|
617 |
|
---|
618 | __xmlRegisterCallbacks = 1;
|
---|
619 | xmlRegisterNodeDefaultValue = func;
|
---|
620 | return(old);
|
---|
621 | }
|
---|
622 |
|
---|
623 | xmlRegisterNodeFunc
|
---|
624 | xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
|
---|
625 | {
|
---|
626 | xmlRegisterNodeFunc old;
|
---|
627 |
|
---|
628 | xmlMutexLock(xmlThrDefMutex);
|
---|
629 | old = xmlRegisterNodeDefaultValueThrDef;
|
---|
630 |
|
---|
631 | __xmlRegisterCallbacks = 1;
|
---|
632 | xmlRegisterNodeDefaultValueThrDef = func;
|
---|
633 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
634 |
|
---|
635 | return(old);
|
---|
636 | }
|
---|
637 |
|
---|
638 | /**
|
---|
639 | * xmlDeregisterNodeDefault:
|
---|
640 | * @func: function pointer to the new DeregisterNodeFunc
|
---|
641 | *
|
---|
642 | * Registers a callback for node destruction
|
---|
643 | *
|
---|
644 | * Returns the previous value of the deregistration function
|
---|
645 | */
|
---|
646 | xmlDeregisterNodeFunc
|
---|
647 | xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
|
---|
648 | {
|
---|
649 | xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
|
---|
650 |
|
---|
651 | __xmlRegisterCallbacks = 1;
|
---|
652 | xmlDeregisterNodeDefaultValue = func;
|
---|
653 | return(old);
|
---|
654 | }
|
---|
655 |
|
---|
656 | xmlDeregisterNodeFunc
|
---|
657 | xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
|
---|
658 | {
|
---|
659 | xmlDeregisterNodeFunc old;
|
---|
660 |
|
---|
661 | xmlMutexLock(xmlThrDefMutex);
|
---|
662 | old = xmlDeregisterNodeDefaultValueThrDef;
|
---|
663 |
|
---|
664 | __xmlRegisterCallbacks = 1;
|
---|
665 | xmlDeregisterNodeDefaultValueThrDef = func;
|
---|
666 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
667 |
|
---|
668 | return(old);
|
---|
669 | }
|
---|
670 |
|
---|
671 | xmlParserInputBufferCreateFilenameFunc
|
---|
672 | xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
|
---|
673 | {
|
---|
674 | xmlParserInputBufferCreateFilenameFunc old;
|
---|
675 |
|
---|
676 | xmlMutexLock(xmlThrDefMutex);
|
---|
677 | old = xmlParserInputBufferCreateFilenameValueThrDef;
|
---|
678 | if (old == NULL) {
|
---|
679 | old = __xmlParserInputBufferCreateFilename;
|
---|
680 | }
|
---|
681 |
|
---|
682 | xmlParserInputBufferCreateFilenameValueThrDef = func;
|
---|
683 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
684 |
|
---|
685 | return(old);
|
---|
686 | }
|
---|
687 |
|
---|
688 | xmlOutputBufferCreateFilenameFunc
|
---|
689 | xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
|
---|
690 | {
|
---|
691 | xmlOutputBufferCreateFilenameFunc old;
|
---|
692 |
|
---|
693 | xmlMutexLock(xmlThrDefMutex);
|
---|
694 | old = xmlOutputBufferCreateFilenameValueThrDef;
|
---|
695 | #ifdef LIBXML_OUTPUT_ENABLED
|
---|
696 | if (old == NULL) {
|
---|
697 | old = __xmlOutputBufferCreateFilename;
|
---|
698 | }
|
---|
699 | #endif
|
---|
700 | xmlOutputBufferCreateFilenameValueThrDef = func;
|
---|
701 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
702 |
|
---|
703 | return(old);
|
---|
704 | }
|
---|
705 |
|
---|
706 | #ifdef LIBXML_DOCB_ENABLED
|
---|
707 | #undef docbDefaultSAXHandler
|
---|
708 | xmlSAXHandlerV1 *
|
---|
709 | __docbDefaultSAXHandler(void) {
|
---|
710 | if (IS_MAIN_THREAD)
|
---|
711 | return (&docbDefaultSAXHandler);
|
---|
712 | else
|
---|
713 | return (&xmlGetGlobalState()->docbDefaultSAXHandler);
|
---|
714 | }
|
---|
715 | #endif
|
---|
716 |
|
---|
717 | #ifdef LIBXML_HTML_ENABLED
|
---|
718 | #undef htmlDefaultSAXHandler
|
---|
719 | xmlSAXHandlerV1 *
|
---|
720 | __htmlDefaultSAXHandler(void) {
|
---|
721 | if (IS_MAIN_THREAD)
|
---|
722 | return (&htmlDefaultSAXHandler);
|
---|
723 | else
|
---|
724 | return (&xmlGetGlobalState()->htmlDefaultSAXHandler);
|
---|
725 | }
|
---|
726 | #endif
|
---|
727 |
|
---|
728 | #undef xmlLastError
|
---|
729 | xmlError *
|
---|
730 | __xmlLastError(void) {
|
---|
731 | if (IS_MAIN_THREAD)
|
---|
732 | return (&xmlLastError);
|
---|
733 | else
|
---|
734 | return (&xmlGetGlobalState()->xmlLastError);
|
---|
735 | }
|
---|
736 |
|
---|
737 | /*
|
---|
738 | * The following memory routines were apparently lost at some point,
|
---|
739 | * and were re-inserted at this point on June 10, 2004. Hope it's
|
---|
740 | * the right place for them :-)
|
---|
741 | */
|
---|
742 | #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED)
|
---|
743 | #undef xmlMalloc
|
---|
744 | xmlMallocFunc *
|
---|
745 | __xmlMalloc(void){
|
---|
746 | if (IS_MAIN_THREAD)
|
---|
747 | return (&xmlMalloc);
|
---|
748 | else
|
---|
749 | return (&xmlGetGlobalState()->xmlMalloc);
|
---|
750 | }
|
---|
751 |
|
---|
752 | #undef xmlMallocAtomic
|
---|
753 | xmlMallocFunc *
|
---|
754 | __xmlMallocAtomic(void){
|
---|
755 | if (IS_MAIN_THREAD)
|
---|
756 | return (&xmlMallocAtomic);
|
---|
757 | else
|
---|
758 | return (&xmlGetGlobalState()->xmlMallocAtomic);
|
---|
759 | }
|
---|
760 |
|
---|
761 | #undef xmlRealloc
|
---|
762 | xmlReallocFunc *
|
---|
763 | __xmlRealloc(void){
|
---|
764 | if (IS_MAIN_THREAD)
|
---|
765 | return (&xmlRealloc);
|
---|
766 | else
|
---|
767 | return (&xmlGetGlobalState()->xmlRealloc);
|
---|
768 | }
|
---|
769 |
|
---|
770 | #undef xmlFree
|
---|
771 | xmlFreeFunc *
|
---|
772 | __xmlFree(void){
|
---|
773 | if (IS_MAIN_THREAD)
|
---|
774 | return (&xmlFree);
|
---|
775 | else
|
---|
776 | return (&xmlGetGlobalState()->xmlFree);
|
---|
777 | }
|
---|
778 |
|
---|
779 | xmlStrdupFunc *
|
---|
780 | __xmlMemStrdup(void){
|
---|
781 | if (IS_MAIN_THREAD)
|
---|
782 | return (&xmlMemStrdup);
|
---|
783 | else
|
---|
784 | return (&xmlGetGlobalState()->xmlMemStrdup);
|
---|
785 | }
|
---|
786 |
|
---|
787 | #endif
|
---|
788 |
|
---|
789 | /*
|
---|
790 | * Everything starting from the line below is
|
---|
791 | * Automatically generated by build_glob.py.
|
---|
792 | * Do not modify the previous line.
|
---|
793 | */
|
---|
794 |
|
---|
795 |
|
---|
796 | #undef oldXMLWDcompatibility
|
---|
797 | int *
|
---|
798 | __oldXMLWDcompatibility(void) {
|
---|
799 | if (IS_MAIN_THREAD)
|
---|
800 | return (&oldXMLWDcompatibility);
|
---|
801 | else
|
---|
802 | return (&xmlGetGlobalState()->oldXMLWDcompatibility);
|
---|
803 | }
|
---|
804 |
|
---|
805 | #undef xmlBufferAllocScheme
|
---|
806 | xmlBufferAllocationScheme *
|
---|
807 | __xmlBufferAllocScheme(void) {
|
---|
808 | if (IS_MAIN_THREAD)
|
---|
809 | return (&xmlBufferAllocScheme);
|
---|
810 | else
|
---|
811 | return (&xmlGetGlobalState()->xmlBufferAllocScheme);
|
---|
812 | }
|
---|
813 | xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
|
---|
814 | xmlBufferAllocationScheme ret;
|
---|
815 | xmlMutexLock(xmlThrDefMutex);
|
---|
816 | ret = xmlBufferAllocSchemeThrDef;
|
---|
817 | xmlBufferAllocSchemeThrDef = v;
|
---|
818 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
819 | return ret;
|
---|
820 | }
|
---|
821 |
|
---|
822 | #undef xmlDefaultBufferSize
|
---|
823 | int *
|
---|
824 | __xmlDefaultBufferSize(void) {
|
---|
825 | if (IS_MAIN_THREAD)
|
---|
826 | return (&xmlDefaultBufferSize);
|
---|
827 | else
|
---|
828 | return (&xmlGetGlobalState()->xmlDefaultBufferSize);
|
---|
829 | }
|
---|
830 | int xmlThrDefDefaultBufferSize(int v) {
|
---|
831 | int ret;
|
---|
832 | xmlMutexLock(xmlThrDefMutex);
|
---|
833 | ret = xmlDefaultBufferSizeThrDef;
|
---|
834 | xmlDefaultBufferSizeThrDef = v;
|
---|
835 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
836 | return ret;
|
---|
837 | }
|
---|
838 |
|
---|
839 | #ifdef LIBXML_SAX1_ENABLED
|
---|
840 | #undef xmlDefaultSAXHandler
|
---|
841 | xmlSAXHandlerV1 *
|
---|
842 | __xmlDefaultSAXHandler(void) {
|
---|
843 | if (IS_MAIN_THREAD)
|
---|
844 | return (&xmlDefaultSAXHandler);
|
---|
845 | else
|
---|
846 | return (&xmlGetGlobalState()->xmlDefaultSAXHandler);
|
---|
847 | }
|
---|
848 | #endif /* LIBXML_SAX1_ENABLED */
|
---|
849 |
|
---|
850 | #undef xmlDefaultSAXLocator
|
---|
851 | xmlSAXLocator *
|
---|
852 | __xmlDefaultSAXLocator(void) {
|
---|
853 | if (IS_MAIN_THREAD)
|
---|
854 | return (&xmlDefaultSAXLocator);
|
---|
855 | else
|
---|
856 | return (&xmlGetGlobalState()->xmlDefaultSAXLocator);
|
---|
857 | }
|
---|
858 |
|
---|
859 | #undef xmlDoValidityCheckingDefaultValue
|
---|
860 | int *
|
---|
861 | __xmlDoValidityCheckingDefaultValue(void) {
|
---|
862 | if (IS_MAIN_THREAD)
|
---|
863 | return (&xmlDoValidityCheckingDefaultValue);
|
---|
864 | else
|
---|
865 | return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue);
|
---|
866 | }
|
---|
867 | int xmlThrDefDoValidityCheckingDefaultValue(int v) {
|
---|
868 | int ret;
|
---|
869 | xmlMutexLock(xmlThrDefMutex);
|
---|
870 | ret = xmlDoValidityCheckingDefaultValueThrDef;
|
---|
871 | xmlDoValidityCheckingDefaultValueThrDef = v;
|
---|
872 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
873 | return ret;
|
---|
874 | }
|
---|
875 |
|
---|
876 | #undef xmlGenericError
|
---|
877 | xmlGenericErrorFunc *
|
---|
878 | __xmlGenericError(void) {
|
---|
879 | if (IS_MAIN_THREAD)
|
---|
880 | return (&xmlGenericError);
|
---|
881 | else
|
---|
882 | return (&xmlGetGlobalState()->xmlGenericError);
|
---|
883 | }
|
---|
884 |
|
---|
885 | #undef xmlStructuredError
|
---|
886 | xmlStructuredErrorFunc *
|
---|
887 | __xmlStructuredError(void) {
|
---|
888 | if (IS_MAIN_THREAD)
|
---|
889 | return (&xmlStructuredError);
|
---|
890 | else
|
---|
891 | return (&xmlGetGlobalState()->xmlStructuredError);
|
---|
892 | }
|
---|
893 |
|
---|
894 | #undef xmlGenericErrorContext
|
---|
895 | void * *
|
---|
896 | __xmlGenericErrorContext(void) {
|
---|
897 | if (IS_MAIN_THREAD)
|
---|
898 | return (&xmlGenericErrorContext);
|
---|
899 | else
|
---|
900 | return (&xmlGetGlobalState()->xmlGenericErrorContext);
|
---|
901 | }
|
---|
902 |
|
---|
903 | #undef xmlStructuredErrorContext
|
---|
904 | void * *
|
---|
905 | __xmlStructuredErrorContext(void) {
|
---|
906 | if (IS_MAIN_THREAD)
|
---|
907 | return (&xmlStructuredErrorContext);
|
---|
908 | else
|
---|
909 | return (&xmlGetGlobalState()->xmlStructuredErrorContext);
|
---|
910 | }
|
---|
911 |
|
---|
912 | #undef xmlGetWarningsDefaultValue
|
---|
913 | int *
|
---|
914 | __xmlGetWarningsDefaultValue(void) {
|
---|
915 | if (IS_MAIN_THREAD)
|
---|
916 | return (&xmlGetWarningsDefaultValue);
|
---|
917 | else
|
---|
918 | return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue);
|
---|
919 | }
|
---|
920 | int xmlThrDefGetWarningsDefaultValue(int v) {
|
---|
921 | int ret;
|
---|
922 | xmlMutexLock(xmlThrDefMutex);
|
---|
923 | ret = xmlGetWarningsDefaultValueThrDef;
|
---|
924 | xmlGetWarningsDefaultValueThrDef = v;
|
---|
925 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
926 | return ret;
|
---|
927 | }
|
---|
928 |
|
---|
929 | #undef xmlIndentTreeOutput
|
---|
930 | int *
|
---|
931 | __xmlIndentTreeOutput(void) {
|
---|
932 | if (IS_MAIN_THREAD)
|
---|
933 | return (&xmlIndentTreeOutput);
|
---|
934 | else
|
---|
935 | return (&xmlGetGlobalState()->xmlIndentTreeOutput);
|
---|
936 | }
|
---|
937 | int xmlThrDefIndentTreeOutput(int v) {
|
---|
938 | int ret;
|
---|
939 | xmlMutexLock(xmlThrDefMutex);
|
---|
940 | ret = xmlIndentTreeOutputThrDef;
|
---|
941 | xmlIndentTreeOutputThrDef = v;
|
---|
942 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
943 | return ret;
|
---|
944 | }
|
---|
945 |
|
---|
946 | #undef xmlTreeIndentString
|
---|
947 | const char * *
|
---|
948 | __xmlTreeIndentString(void) {
|
---|
949 | if (IS_MAIN_THREAD)
|
---|
950 | return (&xmlTreeIndentString);
|
---|
951 | else
|
---|
952 | return (&xmlGetGlobalState()->xmlTreeIndentString);
|
---|
953 | }
|
---|
954 | const char * xmlThrDefTreeIndentString(const char * v) {
|
---|
955 | const char * ret;
|
---|
956 | xmlMutexLock(xmlThrDefMutex);
|
---|
957 | ret = xmlTreeIndentStringThrDef;
|
---|
958 | xmlTreeIndentStringThrDef = v;
|
---|
959 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
960 | return ret;
|
---|
961 | }
|
---|
962 |
|
---|
963 | #undef xmlKeepBlanksDefaultValue
|
---|
964 | int *
|
---|
965 | __xmlKeepBlanksDefaultValue(void) {
|
---|
966 | if (IS_MAIN_THREAD)
|
---|
967 | return (&xmlKeepBlanksDefaultValue);
|
---|
968 | else
|
---|
969 | return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue);
|
---|
970 | }
|
---|
971 | int xmlThrDefKeepBlanksDefaultValue(int v) {
|
---|
972 | int ret;
|
---|
973 | xmlMutexLock(xmlThrDefMutex);
|
---|
974 | ret = xmlKeepBlanksDefaultValueThrDef;
|
---|
975 | xmlKeepBlanksDefaultValueThrDef = v;
|
---|
976 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
977 | return ret;
|
---|
978 | }
|
---|
979 |
|
---|
980 | #undef xmlLineNumbersDefaultValue
|
---|
981 | int *
|
---|
982 | __xmlLineNumbersDefaultValue(void) {
|
---|
983 | if (IS_MAIN_THREAD)
|
---|
984 | return (&xmlLineNumbersDefaultValue);
|
---|
985 | else
|
---|
986 | return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue);
|
---|
987 | }
|
---|
988 | int xmlThrDefLineNumbersDefaultValue(int v) {
|
---|
989 | int ret;
|
---|
990 | xmlMutexLock(xmlThrDefMutex);
|
---|
991 | ret = xmlLineNumbersDefaultValueThrDef;
|
---|
992 | xmlLineNumbersDefaultValueThrDef = v;
|
---|
993 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
994 | return ret;
|
---|
995 | }
|
---|
996 |
|
---|
997 | #undef xmlLoadExtDtdDefaultValue
|
---|
998 | int *
|
---|
999 | __xmlLoadExtDtdDefaultValue(void) {
|
---|
1000 | if (IS_MAIN_THREAD)
|
---|
1001 | return (&xmlLoadExtDtdDefaultValue);
|
---|
1002 | else
|
---|
1003 | return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue);
|
---|
1004 | }
|
---|
1005 | int xmlThrDefLoadExtDtdDefaultValue(int v) {
|
---|
1006 | int ret;
|
---|
1007 | xmlMutexLock(xmlThrDefMutex);
|
---|
1008 | ret = xmlLoadExtDtdDefaultValueThrDef;
|
---|
1009 | xmlLoadExtDtdDefaultValueThrDef = v;
|
---|
1010 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
1011 | return ret;
|
---|
1012 | }
|
---|
1013 |
|
---|
1014 | #undef xmlParserDebugEntities
|
---|
1015 | int *
|
---|
1016 | __xmlParserDebugEntities(void) {
|
---|
1017 | if (IS_MAIN_THREAD)
|
---|
1018 | return (&xmlParserDebugEntities);
|
---|
1019 | else
|
---|
1020 | return (&xmlGetGlobalState()->xmlParserDebugEntities);
|
---|
1021 | }
|
---|
1022 | int xmlThrDefParserDebugEntities(int v) {
|
---|
1023 | int ret;
|
---|
1024 | xmlMutexLock(xmlThrDefMutex);
|
---|
1025 | ret = xmlParserDebugEntitiesThrDef;
|
---|
1026 | xmlParserDebugEntitiesThrDef = v;
|
---|
1027 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
1028 | return ret;
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | #undef xmlParserVersion
|
---|
1032 | const char * *
|
---|
1033 | __xmlParserVersion(void) {
|
---|
1034 | if (IS_MAIN_THREAD)
|
---|
1035 | return (&xmlParserVersion);
|
---|
1036 | else
|
---|
1037 | return (&xmlGetGlobalState()->xmlParserVersion);
|
---|
1038 | }
|
---|
1039 |
|
---|
1040 | #undef xmlPedanticParserDefaultValue
|
---|
1041 | int *
|
---|
1042 | __xmlPedanticParserDefaultValue(void) {
|
---|
1043 | if (IS_MAIN_THREAD)
|
---|
1044 | return (&xmlPedanticParserDefaultValue);
|
---|
1045 | else
|
---|
1046 | return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue);
|
---|
1047 | }
|
---|
1048 | int xmlThrDefPedanticParserDefaultValue(int v) {
|
---|
1049 | int ret;
|
---|
1050 | xmlMutexLock(xmlThrDefMutex);
|
---|
1051 | ret = xmlPedanticParserDefaultValueThrDef;
|
---|
1052 | xmlPedanticParserDefaultValueThrDef = v;
|
---|
1053 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
1054 | return ret;
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 | #undef xmlSaveNoEmptyTags
|
---|
1058 | int *
|
---|
1059 | __xmlSaveNoEmptyTags(void) {
|
---|
1060 | if (IS_MAIN_THREAD)
|
---|
1061 | return (&xmlSaveNoEmptyTags);
|
---|
1062 | else
|
---|
1063 | return (&xmlGetGlobalState()->xmlSaveNoEmptyTags);
|
---|
1064 | }
|
---|
1065 | int xmlThrDefSaveNoEmptyTags(int v) {
|
---|
1066 | int ret;
|
---|
1067 | xmlMutexLock(xmlThrDefMutex);
|
---|
1068 | ret = xmlSaveNoEmptyTagsThrDef;
|
---|
1069 | xmlSaveNoEmptyTagsThrDef = v;
|
---|
1070 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
1071 | return ret;
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | #undef xmlSubstituteEntitiesDefaultValue
|
---|
1075 | int *
|
---|
1076 | __xmlSubstituteEntitiesDefaultValue(void) {
|
---|
1077 | if (IS_MAIN_THREAD)
|
---|
1078 | return (&xmlSubstituteEntitiesDefaultValue);
|
---|
1079 | else
|
---|
1080 | return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue);
|
---|
1081 | }
|
---|
1082 | int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
|
---|
1083 | int ret;
|
---|
1084 | xmlMutexLock(xmlThrDefMutex);
|
---|
1085 | ret = xmlSubstituteEntitiesDefaultValueThrDef;
|
---|
1086 | xmlSubstituteEntitiesDefaultValueThrDef = v;
|
---|
1087 | xmlMutexUnlock(xmlThrDefMutex);
|
---|
1088 | return ret;
|
---|
1089 | }
|
---|
1090 |
|
---|
1091 | #undef xmlRegisterNodeDefaultValue
|
---|
1092 | xmlRegisterNodeFunc *
|
---|
1093 | __xmlRegisterNodeDefaultValue(void) {
|
---|
1094 | if (IS_MAIN_THREAD)
|
---|
1095 | return (&xmlRegisterNodeDefaultValue);
|
---|
1096 | else
|
---|
1097 | return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue);
|
---|
1098 | }
|
---|
1099 |
|
---|
1100 | #undef xmlDeregisterNodeDefaultValue
|
---|
1101 | xmlDeregisterNodeFunc *
|
---|
1102 | __xmlDeregisterNodeDefaultValue(void) {
|
---|
1103 | if (IS_MAIN_THREAD)
|
---|
1104 | return (&xmlDeregisterNodeDefaultValue);
|
---|
1105 | else
|
---|
1106 | return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue);
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | #undef xmlParserInputBufferCreateFilenameValue
|
---|
1110 | xmlParserInputBufferCreateFilenameFunc *
|
---|
1111 | __xmlParserInputBufferCreateFilenameValue(void) {
|
---|
1112 | if (IS_MAIN_THREAD)
|
---|
1113 | return (&xmlParserInputBufferCreateFilenameValue);
|
---|
1114 | else
|
---|
1115 | return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue);
|
---|
1116 | }
|
---|
1117 |
|
---|
1118 | #undef xmlOutputBufferCreateFilenameValue
|
---|
1119 | xmlOutputBufferCreateFilenameFunc *
|
---|
1120 | __xmlOutputBufferCreateFilenameValue(void) {
|
---|
1121 | if (IS_MAIN_THREAD)
|
---|
1122 | return (&xmlOutputBufferCreateFilenameValue);
|
---|
1123 | else
|
---|
1124 | return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
|
---|
1125 | }
|
---|
1126 |
|
---|
1127 | #define bottom_globals
|
---|
1128 | #include "elfgcchack.h"
|
---|