/src/libxml2-2.10.3/globals.c
Line | Count | Source (jump to first uncovered line) |
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 <Gary.Pennington@uk.sun.com> |
11 | | * daniel@veillard.com |
12 | | */ |
13 | | |
14 | | #define IN_LIBXML |
15 | | #include "libxml.h" |
16 | | |
17 | | #include <stdlib.h> |
18 | | #include <string.h> |
19 | | |
20 | | #include <libxml/globals.h> |
21 | | #include <libxml/xmlmemory.h> |
22 | | #include <libxml/threads.h> |
23 | | |
24 | | /* #define DEBUG_GLOBALS */ |
25 | | |
26 | | /* |
27 | | * Helpful Macro |
28 | | */ |
29 | | #ifdef LIBXML_THREAD_ENABLED |
30 | 6.93M | #define IS_MAIN_THREAD (xmlIsMainThread()) |
31 | | #else |
32 | | #define IS_MAIN_THREAD 1 |
33 | | #endif |
34 | | |
35 | | /* |
36 | | * Mutex to protect "ForNewThreads" variables |
37 | | */ |
38 | | static xmlMutexPtr xmlThrDefMutex = NULL; |
39 | | |
40 | | /** |
41 | | * xmlInitGlobals: |
42 | | * |
43 | | * DEPRECATED: This function will be made private. Call xmlInitParser to |
44 | | * initialize the library. |
45 | | * |
46 | | * Additional initialisation for multi-threading |
47 | | */ |
48 | | void xmlInitGlobals(void) |
49 | 1 | { |
50 | 1 | if (xmlThrDefMutex == NULL) |
51 | 1 | xmlThrDefMutex = xmlNewMutex(); |
52 | 1 | } |
53 | | |
54 | | /************************************************************************ |
55 | | * * |
56 | | * All the user accessible global variables of the library * |
57 | | * * |
58 | | ************************************************************************/ |
59 | | |
60 | | /* |
61 | | * Memory allocation routines |
62 | | */ |
63 | | #undef xmlFree |
64 | | #undef xmlMalloc |
65 | | #undef xmlMallocAtomic |
66 | | #undef xmlMemStrdup |
67 | | #undef xmlRealloc |
68 | | |
69 | | #if defined(DEBUG_MEMORY_LOCATION) || defined(DEBUG_MEMORY) |
70 | | xmlFreeFunc xmlFree = (xmlFreeFunc) xmlMemFree; |
71 | | xmlMallocFunc xmlMalloc = (xmlMallocFunc) xmlMemMalloc; |
72 | | xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc; |
73 | | xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc; |
74 | | xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; |
75 | | #else |
76 | | /** |
77 | | * xmlFree: |
78 | | * @mem: an already allocated block of memory |
79 | | * |
80 | | * The variable holding the libxml free() implementation |
81 | | */ |
82 | | xmlFreeFunc xmlFree = free; |
83 | | /** |
84 | | * xmlMalloc: |
85 | | * @size: the size requested in bytes |
86 | | * |
87 | | * The variable holding the libxml malloc() implementation |
88 | | * |
89 | | * Returns a pointer to the newly allocated block or NULL in case of error |
90 | | */ |
91 | | xmlMallocFunc xmlMalloc = malloc; |
92 | | /** |
93 | | * xmlMallocAtomic: |
94 | | * @size: the size requested in bytes |
95 | | * |
96 | | * The variable holding the libxml malloc() implementation for atomic |
97 | | * data (i.e. blocks not containing pointers), useful when using a |
98 | | * garbage collecting allocator. |
99 | | * |
100 | | * Returns a pointer to the newly allocated block or NULL in case of error |
101 | | */ |
102 | | xmlMallocFunc xmlMallocAtomic = malloc; |
103 | | /** |
104 | | * xmlRealloc: |
105 | | * @mem: an already allocated block of memory |
106 | | * @size: the new size requested in bytes |
107 | | * |
108 | | * The variable holding the libxml realloc() implementation |
109 | | * |
110 | | * Returns a pointer to the newly reallocated block or NULL in case of error |
111 | | */ |
112 | | xmlReallocFunc xmlRealloc = realloc; |
113 | | /** |
114 | | * xmlPosixStrdup |
115 | | * @cur: the input char * |
116 | | * |
117 | | * a strdup implementation with a type signature matching POSIX |
118 | | * |
119 | | * Returns a new xmlChar * or NULL |
120 | | */ |
121 | | static char * |
122 | 2.76k | xmlPosixStrdup(const char *cur) { |
123 | 2.76k | return((char*) xmlCharStrdup(cur)); |
124 | 2.76k | } |
125 | | /** |
126 | | * xmlMemStrdup: |
127 | | * @str: a zero terminated string |
128 | | * |
129 | | * The variable holding the libxml strdup() implementation |
130 | | * |
131 | | * Returns the copy of the string or NULL in case of error |
132 | | */ |
133 | | xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup; |
134 | | #endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */ |
135 | | |
136 | | #include <libxml/threads.h> |
137 | | #include <libxml/globals.h> |
138 | | #include <libxml/SAX.h> |
139 | | |
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 | | /** |
447 | | * xmlInitializeGlobalState: |
448 | | * @gs: a pointer to a newly allocated global state |
449 | | * |
450 | | * xmlInitializeGlobalState() initialize a global state with all the |
451 | | * default values of the library. |
452 | | */ |
453 | | void |
454 | | xmlInitializeGlobalState(xmlGlobalStatePtr gs) |
455 | 0 | { |
456 | | #ifdef DEBUG_GLOBALS |
457 | | fprintf(stderr, "Initializing globals at %lu for thread %d\n", |
458 | | (unsigned long) gs, xmlGetThreadId()); |
459 | | #endif |
460 | | |
461 | | /* |
462 | | * Perform initialization as required by libxml |
463 | | */ |
464 | 0 | if (xmlThrDefMutex == NULL) |
465 | 0 | xmlInitGlobals(); |
466 | |
|
467 | 0 | xmlMutexLock(xmlThrDefMutex); |
468 | |
|
469 | | #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED) |
470 | | inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); |
471 | | #endif |
472 | |
|
473 | 0 | gs->oldXMLWDcompatibility = 0; |
474 | 0 | gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef; |
475 | 0 | gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef; |
476 | | #if defined(LIBXML_SAX1_ENABLED) && defined(LIBXML_LEGACY_ENABLED) |
477 | | initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1); |
478 | | #endif /* LIBXML_SAX1_ENABLED */ |
479 | 0 | gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId; |
480 | 0 | gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId; |
481 | 0 | gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber; |
482 | 0 | gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber; |
483 | 0 | gs->xmlDoValidityCheckingDefaultValue = |
484 | 0 | xmlDoValidityCheckingDefaultValueThrDef; |
485 | | #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY) |
486 | | gs->xmlFree = (xmlFreeFunc) xmlMemFree; |
487 | | gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc; |
488 | | gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc; |
489 | | gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc; |
490 | | gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup; |
491 | | #else |
492 | 0 | gs->xmlFree = (xmlFreeFunc) free; |
493 | 0 | gs->xmlMalloc = (xmlMallocFunc) malloc; |
494 | 0 | gs->xmlMallocAtomic = (xmlMallocFunc) malloc; |
495 | 0 | gs->xmlRealloc = (xmlReallocFunc) realloc; |
496 | 0 | gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; |
497 | 0 | #endif |
498 | 0 | gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef; |
499 | 0 | gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef; |
500 | 0 | gs->xmlTreeIndentString = xmlTreeIndentStringThrDef; |
501 | 0 | gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef; |
502 | 0 | gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; |
503 | 0 | gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; |
504 | 0 | gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef; |
505 | 0 | gs->xmlParserVersion = LIBXML_VERSION_STRING; |
506 | 0 | gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; |
507 | 0 | gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; |
508 | 0 | gs->xmlSubstituteEntitiesDefaultValue = |
509 | 0 | xmlSubstituteEntitiesDefaultValueThrDef; |
510 | |
|
511 | 0 | gs->xmlGenericError = xmlGenericErrorThrDef; |
512 | 0 | gs->xmlStructuredError = xmlStructuredErrorThrDef; |
513 | 0 | gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; |
514 | 0 | gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef; |
515 | 0 | gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; |
516 | 0 | gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; |
517 | |
|
518 | 0 | gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef; |
519 | 0 | gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef; |
520 | 0 | memset(&gs->xmlLastError, 0, sizeof(xmlError)); |
521 | |
|
522 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
523 | 0 | } |
524 | | |
525 | | /** |
526 | | * xmlCleanupGlobals: |
527 | | * |
528 | | * DEPRECATED: This function will be made private. Call xmlCleanupParser |
529 | | * to free global state but see the warnings there. xmlCleanupParser |
530 | | * should be only called once at program exit. In most cases, you don't |
531 | | * have call cleanup functions at all. |
532 | | * |
533 | | * Additional cleanup for multi-threading |
534 | | */ |
535 | | void xmlCleanupGlobals(void) |
536 | 0 | { |
537 | 0 | xmlResetError(&xmlLastError); |
538 | |
|
539 | 0 | if (xmlThrDefMutex != NULL) { |
540 | 0 | xmlFreeMutex(xmlThrDefMutex); |
541 | 0 | xmlThrDefMutex = NULL; |
542 | 0 | } |
543 | 0 | __xmlGlobalInitMutexDestroy(); |
544 | 0 | } |
545 | | |
546 | | /** |
547 | | * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions, |
548 | | * those are really internal work |
549 | | */ |
550 | | void |
551 | 0 | xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { |
552 | 0 | xmlMutexLock(xmlThrDefMutex); |
553 | 0 | xmlGenericErrorContextThrDef = ctx; |
554 | 0 | if (handler != NULL) |
555 | 0 | xmlGenericErrorThrDef = handler; |
556 | 0 | else |
557 | 0 | xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc; |
558 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
559 | 0 | } |
560 | | |
561 | | void |
562 | 0 | xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { |
563 | 0 | xmlMutexLock(xmlThrDefMutex); |
564 | 0 | xmlStructuredErrorContextThrDef = ctx; |
565 | 0 | xmlStructuredErrorThrDef = handler; |
566 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
567 | 0 | } |
568 | | |
569 | | /** |
570 | | * xmlRegisterNodeDefault: |
571 | | * @func: function pointer to the new RegisterNodeFunc |
572 | | * |
573 | | * Registers a callback for node creation |
574 | | * |
575 | | * Returns the old value of the registration function |
576 | | */ |
577 | | xmlRegisterNodeFunc |
578 | | xmlRegisterNodeDefault(xmlRegisterNodeFunc func) |
579 | 0 | { |
580 | 0 | xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue; |
581 | |
|
582 | 0 | __xmlRegisterCallbacks = 1; |
583 | 0 | xmlRegisterNodeDefaultValue = func; |
584 | 0 | return(old); |
585 | 0 | } |
586 | | |
587 | | xmlRegisterNodeFunc |
588 | | xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func) |
589 | 0 | { |
590 | 0 | xmlRegisterNodeFunc old; |
591 | |
|
592 | 0 | xmlMutexLock(xmlThrDefMutex); |
593 | 0 | old = xmlRegisterNodeDefaultValueThrDef; |
594 | |
|
595 | 0 | __xmlRegisterCallbacks = 1; |
596 | 0 | xmlRegisterNodeDefaultValueThrDef = func; |
597 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
598 | |
|
599 | 0 | return(old); |
600 | 0 | } |
601 | | |
602 | | /** |
603 | | * xmlDeregisterNodeDefault: |
604 | | * @func: function pointer to the new DeregisterNodeFunc |
605 | | * |
606 | | * Registers a callback for node destruction |
607 | | * |
608 | | * Returns the previous value of the deregistration function |
609 | | */ |
610 | | xmlDeregisterNodeFunc |
611 | | xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func) |
612 | 0 | { |
613 | 0 | xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue; |
614 | |
|
615 | 0 | __xmlRegisterCallbacks = 1; |
616 | 0 | xmlDeregisterNodeDefaultValue = func; |
617 | 0 | return(old); |
618 | 0 | } |
619 | | |
620 | | xmlDeregisterNodeFunc |
621 | | xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func) |
622 | 0 | { |
623 | 0 | xmlDeregisterNodeFunc old; |
624 | |
|
625 | 0 | xmlMutexLock(xmlThrDefMutex); |
626 | 0 | old = xmlDeregisterNodeDefaultValueThrDef; |
627 | |
|
628 | 0 | __xmlRegisterCallbacks = 1; |
629 | 0 | xmlDeregisterNodeDefaultValueThrDef = func; |
630 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
631 | |
|
632 | 0 | return(old); |
633 | 0 | } |
634 | | |
635 | | xmlParserInputBufferCreateFilenameFunc |
636 | | xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func) |
637 | 0 | { |
638 | 0 | xmlParserInputBufferCreateFilenameFunc old; |
639 | |
|
640 | 0 | xmlMutexLock(xmlThrDefMutex); |
641 | 0 | old = xmlParserInputBufferCreateFilenameValueThrDef; |
642 | 0 | if (old == NULL) { |
643 | 0 | old = __xmlParserInputBufferCreateFilename; |
644 | 0 | } |
645 | |
|
646 | 0 | xmlParserInputBufferCreateFilenameValueThrDef = func; |
647 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
648 | |
|
649 | 0 | return(old); |
650 | 0 | } |
651 | | |
652 | | xmlOutputBufferCreateFilenameFunc |
653 | | xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func) |
654 | 0 | { |
655 | 0 | xmlOutputBufferCreateFilenameFunc old; |
656 | |
|
657 | 0 | xmlMutexLock(xmlThrDefMutex); |
658 | 0 | old = xmlOutputBufferCreateFilenameValueThrDef; |
659 | 0 | #ifdef LIBXML_OUTPUT_ENABLED |
660 | 0 | if (old == NULL) { |
661 | 0 | old = __xmlOutputBufferCreateFilename; |
662 | 0 | } |
663 | 0 | #endif |
664 | 0 | xmlOutputBufferCreateFilenameValueThrDef = func; |
665 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
666 | |
|
667 | 0 | return(old); |
668 | 0 | } |
669 | | |
670 | | #ifdef LIBXML_HTML_ENABLED |
671 | | #undef htmlDefaultSAXHandler |
672 | | xmlSAXHandlerV1 * |
673 | 1 | __htmlDefaultSAXHandler(void) { |
674 | 1 | if (IS_MAIN_THREAD) |
675 | 1 | return (&htmlDefaultSAXHandler); |
676 | 0 | else |
677 | 0 | return (&xmlGetGlobalState()->htmlDefaultSAXHandler); |
678 | 1 | } |
679 | | #endif |
680 | | |
681 | | #undef xmlLastError |
682 | | xmlError * |
683 | 3.26M | __xmlLastError(void) { |
684 | 3.26M | if (IS_MAIN_THREAD) |
685 | 3.26M | return (&xmlLastError); |
686 | 0 | else |
687 | 0 | return (&xmlGetGlobalState()->xmlLastError); |
688 | 3.26M | } |
689 | | |
690 | | /* |
691 | | * The following memory routines were apparently lost at some point, |
692 | | * and were re-inserted at this point on June 10, 2004. Hope it's |
693 | | * the right place for them :-) |
694 | | */ |
695 | | #if defined(LIBXML_THREAD_ALLOC_ENABLED) && defined(LIBXML_THREAD_ENABLED) |
696 | | #undef xmlMalloc |
697 | | xmlMallocFunc * |
698 | | __xmlMalloc(void){ |
699 | | if (IS_MAIN_THREAD) |
700 | | return (&xmlMalloc); |
701 | | else |
702 | | return (&xmlGetGlobalState()->xmlMalloc); |
703 | | } |
704 | | |
705 | | #undef xmlMallocAtomic |
706 | | xmlMallocFunc * |
707 | | __xmlMallocAtomic(void){ |
708 | | if (IS_MAIN_THREAD) |
709 | | return (&xmlMallocAtomic); |
710 | | else |
711 | | return (&xmlGetGlobalState()->xmlMallocAtomic); |
712 | | } |
713 | | |
714 | | #undef xmlRealloc |
715 | | xmlReallocFunc * |
716 | | __xmlRealloc(void){ |
717 | | if (IS_MAIN_THREAD) |
718 | | return (&xmlRealloc); |
719 | | else |
720 | | return (&xmlGetGlobalState()->xmlRealloc); |
721 | | } |
722 | | |
723 | | #undef xmlFree |
724 | | xmlFreeFunc * |
725 | | __xmlFree(void){ |
726 | | if (IS_MAIN_THREAD) |
727 | | return (&xmlFree); |
728 | | else |
729 | | return (&xmlGetGlobalState()->xmlFree); |
730 | | } |
731 | | |
732 | | xmlStrdupFunc * |
733 | | __xmlMemStrdup(void){ |
734 | | if (IS_MAIN_THREAD) |
735 | | return (&xmlMemStrdup); |
736 | | else |
737 | | return (&xmlGetGlobalState()->xmlMemStrdup); |
738 | | } |
739 | | |
740 | | #endif |
741 | | |
742 | | /* |
743 | | * Everything starting from the line below is |
744 | | * Automatically generated by build_glob.py. |
745 | | * Do not modify the previous line. |
746 | | */ |
747 | | |
748 | | |
749 | | #undef oldXMLWDcompatibility |
750 | | int * |
751 | 0 | __oldXMLWDcompatibility(void) { |
752 | 0 | if (IS_MAIN_THREAD) |
753 | 0 | return (&oldXMLWDcompatibility); |
754 | 0 | else |
755 | 0 | return (&xmlGetGlobalState()->oldXMLWDcompatibility); |
756 | 0 | } |
757 | | |
758 | | #undef xmlBufferAllocScheme |
759 | | xmlBufferAllocationScheme * |
760 | 22.0k | __xmlBufferAllocScheme(void) { |
761 | 22.0k | if (IS_MAIN_THREAD) |
762 | 22.0k | return (&xmlBufferAllocScheme); |
763 | 0 | else |
764 | 0 | return (&xmlGetGlobalState()->xmlBufferAllocScheme); |
765 | 22.0k | } |
766 | 0 | xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) { |
767 | 0 | xmlBufferAllocationScheme ret; |
768 | 0 | xmlMutexLock(xmlThrDefMutex); |
769 | 0 | ret = xmlBufferAllocSchemeThrDef; |
770 | 0 | xmlBufferAllocSchemeThrDef = v; |
771 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
772 | 0 | return ret; |
773 | 0 | } |
774 | | |
775 | | #undef xmlDefaultBufferSize |
776 | | int * |
777 | 22.0k | __xmlDefaultBufferSize(void) { |
778 | 22.0k | if (IS_MAIN_THREAD) |
779 | 22.0k | return (&xmlDefaultBufferSize); |
780 | 0 | else |
781 | 0 | return (&xmlGetGlobalState()->xmlDefaultBufferSize); |
782 | 22.0k | } |
783 | 0 | int xmlThrDefDefaultBufferSize(int v) { |
784 | 0 | int ret; |
785 | 0 | xmlMutexLock(xmlThrDefMutex); |
786 | 0 | ret = xmlDefaultBufferSizeThrDef; |
787 | 0 | xmlDefaultBufferSizeThrDef = v; |
788 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
789 | 0 | return ret; |
790 | 0 | } |
791 | | |
792 | | #ifdef LIBXML_SAX1_ENABLED |
793 | | #undef xmlDefaultSAXHandler |
794 | | xmlSAXHandlerV1 * |
795 | 36.6k | __xmlDefaultSAXHandler(void) { |
796 | 36.6k | if (IS_MAIN_THREAD) |
797 | 36.6k | return (&xmlDefaultSAXHandler); |
798 | 0 | else |
799 | 0 | return (&xmlGetGlobalState()->xmlDefaultSAXHandler); |
800 | 36.6k | } |
801 | | #endif /* LIBXML_SAX1_ENABLED */ |
802 | | |
803 | | #undef xmlDefaultSAXLocator |
804 | | xmlSAXLocator * |
805 | 0 | __xmlDefaultSAXLocator(void) { |
806 | 0 | if (IS_MAIN_THREAD) |
807 | 0 | return (&xmlDefaultSAXLocator); |
808 | 0 | else |
809 | 0 | return (&xmlGetGlobalState()->xmlDefaultSAXLocator); |
810 | 0 | } |
811 | | |
812 | | #undef xmlDoValidityCheckingDefaultValue |
813 | | int * |
814 | 18.3k | __xmlDoValidityCheckingDefaultValue(void) { |
815 | 18.3k | if (IS_MAIN_THREAD) |
816 | 18.3k | return (&xmlDoValidityCheckingDefaultValue); |
817 | 0 | else |
818 | 0 | return (&xmlGetGlobalState()->xmlDoValidityCheckingDefaultValue); |
819 | 18.3k | } |
820 | 0 | int xmlThrDefDoValidityCheckingDefaultValue(int v) { |
821 | 0 | int ret; |
822 | 0 | xmlMutexLock(xmlThrDefMutex); |
823 | 0 | ret = xmlDoValidityCheckingDefaultValueThrDef; |
824 | 0 | xmlDoValidityCheckingDefaultValueThrDef = v; |
825 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
826 | 0 | return ret; |
827 | 0 | } |
828 | | |
829 | | #undef xmlGenericError |
830 | | xmlGenericErrorFunc * |
831 | 54.9k | __xmlGenericError(void) { |
832 | 54.9k | if (IS_MAIN_THREAD) |
833 | 54.9k | return (&xmlGenericError); |
834 | 0 | else |
835 | 0 | return (&xmlGetGlobalState()->xmlGenericError); |
836 | 54.9k | } |
837 | | |
838 | | #undef xmlStructuredError |
839 | | xmlStructuredErrorFunc * |
840 | 1.14M | __xmlStructuredError(void) { |
841 | 1.14M | if (IS_MAIN_THREAD) |
842 | 1.14M | return (&xmlStructuredError); |
843 | 0 | else |
844 | 0 | return (&xmlGetGlobalState()->xmlStructuredError); |
845 | 1.14M | } |
846 | | |
847 | | #undef xmlGenericErrorContext |
848 | | void * * |
849 | 54.9k | __xmlGenericErrorContext(void) { |
850 | 54.9k | if (IS_MAIN_THREAD) |
851 | 54.9k | return (&xmlGenericErrorContext); |
852 | 0 | else |
853 | 0 | return (&xmlGetGlobalState()->xmlGenericErrorContext); |
854 | 54.9k | } |
855 | | |
856 | | #undef xmlStructuredErrorContext |
857 | | void * * |
858 | 1.14M | __xmlStructuredErrorContext(void) { |
859 | 1.14M | if (IS_MAIN_THREAD) |
860 | 1.14M | return (&xmlStructuredErrorContext); |
861 | 0 | else |
862 | 0 | return (&xmlGetGlobalState()->xmlStructuredErrorContext); |
863 | 1.14M | } |
864 | | |
865 | | #undef xmlGetWarningsDefaultValue |
866 | | int * |
867 | 1.08M | __xmlGetWarningsDefaultValue(void) { |
868 | 1.08M | if (IS_MAIN_THREAD) |
869 | 1.08M | return (&xmlGetWarningsDefaultValue); |
870 | 0 | else |
871 | 0 | return (&xmlGetGlobalState()->xmlGetWarningsDefaultValue); |
872 | 1.08M | } |
873 | 0 | int xmlThrDefGetWarningsDefaultValue(int v) { |
874 | 0 | int ret; |
875 | 0 | xmlMutexLock(xmlThrDefMutex); |
876 | 0 | ret = xmlGetWarningsDefaultValueThrDef; |
877 | 0 | xmlGetWarningsDefaultValueThrDef = v; |
878 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
879 | 0 | return ret; |
880 | 0 | } |
881 | | |
882 | | #undef xmlIndentTreeOutput |
883 | | int * |
884 | 0 | __xmlIndentTreeOutput(void) { |
885 | 0 | if (IS_MAIN_THREAD) |
886 | 0 | return (&xmlIndentTreeOutput); |
887 | 0 | else |
888 | 0 | return (&xmlGetGlobalState()->xmlIndentTreeOutput); |
889 | 0 | } |
890 | 0 | int xmlThrDefIndentTreeOutput(int v) { |
891 | 0 | int ret; |
892 | 0 | xmlMutexLock(xmlThrDefMutex); |
893 | 0 | ret = xmlIndentTreeOutputThrDef; |
894 | 0 | xmlIndentTreeOutputThrDef = v; |
895 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
896 | 0 | return ret; |
897 | 0 | } |
898 | | |
899 | | #undef xmlTreeIndentString |
900 | | const char * * |
901 | 0 | __xmlTreeIndentString(void) { |
902 | 0 | if (IS_MAIN_THREAD) |
903 | 0 | return (&xmlTreeIndentString); |
904 | 0 | else |
905 | 0 | return (&xmlGetGlobalState()->xmlTreeIndentString); |
906 | 0 | } |
907 | 0 | const char * xmlThrDefTreeIndentString(const char * v) { |
908 | 0 | const char * ret; |
909 | 0 | xmlMutexLock(xmlThrDefMutex); |
910 | 0 | ret = xmlTreeIndentStringThrDef; |
911 | 0 | xmlTreeIndentStringThrDef = v; |
912 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
913 | 0 | return ret; |
914 | 0 | } |
915 | | |
916 | | #undef xmlKeepBlanksDefaultValue |
917 | | int * |
918 | 18.3k | __xmlKeepBlanksDefaultValue(void) { |
919 | 18.3k | if (IS_MAIN_THREAD) |
920 | 18.3k | return (&xmlKeepBlanksDefaultValue); |
921 | 0 | else |
922 | 0 | return (&xmlGetGlobalState()->xmlKeepBlanksDefaultValue); |
923 | 18.3k | } |
924 | 0 | int xmlThrDefKeepBlanksDefaultValue(int v) { |
925 | 0 | int ret; |
926 | 0 | xmlMutexLock(xmlThrDefMutex); |
927 | 0 | ret = xmlKeepBlanksDefaultValueThrDef; |
928 | 0 | xmlKeepBlanksDefaultValueThrDef = v; |
929 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
930 | 0 | return ret; |
931 | 0 | } |
932 | | |
933 | | #undef xmlLineNumbersDefaultValue |
934 | | int * |
935 | 18.3k | __xmlLineNumbersDefaultValue(void) { |
936 | 18.3k | if (IS_MAIN_THREAD) |
937 | 18.3k | return (&xmlLineNumbersDefaultValue); |
938 | 0 | else |
939 | 0 | return (&xmlGetGlobalState()->xmlLineNumbersDefaultValue); |
940 | 18.3k | } |
941 | 0 | int xmlThrDefLineNumbersDefaultValue(int v) { |
942 | 0 | int ret; |
943 | 0 | xmlMutexLock(xmlThrDefMutex); |
944 | 0 | ret = xmlLineNumbersDefaultValueThrDef; |
945 | 0 | xmlLineNumbersDefaultValueThrDef = v; |
946 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
947 | 0 | return ret; |
948 | 0 | } |
949 | | |
950 | | #undef xmlLoadExtDtdDefaultValue |
951 | | int * |
952 | 18.3k | __xmlLoadExtDtdDefaultValue(void) { |
953 | 18.3k | if (IS_MAIN_THREAD) |
954 | 18.3k | return (&xmlLoadExtDtdDefaultValue); |
955 | 0 | else |
956 | 0 | return (&xmlGetGlobalState()->xmlLoadExtDtdDefaultValue); |
957 | 18.3k | } |
958 | 0 | int xmlThrDefLoadExtDtdDefaultValue(int v) { |
959 | 0 | int ret; |
960 | 0 | xmlMutexLock(xmlThrDefMutex); |
961 | 0 | ret = xmlLoadExtDtdDefaultValueThrDef; |
962 | 0 | xmlLoadExtDtdDefaultValueThrDef = v; |
963 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
964 | 0 | return ret; |
965 | 0 | } |
966 | | |
967 | | #undef xmlParserDebugEntities |
968 | | int * |
969 | 1.16k | __xmlParserDebugEntities(void) { |
970 | 1.16k | if (IS_MAIN_THREAD) |
971 | 1.16k | return (&xmlParserDebugEntities); |
972 | 0 | else |
973 | 0 | return (&xmlGetGlobalState()->xmlParserDebugEntities); |
974 | 1.16k | } |
975 | 0 | int xmlThrDefParserDebugEntities(int v) { |
976 | 0 | int ret; |
977 | 0 | xmlMutexLock(xmlThrDefMutex); |
978 | 0 | ret = xmlParserDebugEntitiesThrDef; |
979 | 0 | xmlParserDebugEntitiesThrDef = v; |
980 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
981 | 0 | return ret; |
982 | 0 | } |
983 | | |
984 | | #undef xmlParserVersion |
985 | | const char * * |
986 | 0 | __xmlParserVersion(void) { |
987 | 0 | if (IS_MAIN_THREAD) |
988 | 0 | return (&xmlParserVersion); |
989 | 0 | else |
990 | 0 | return (&xmlGetGlobalState()->xmlParserVersion); |
991 | 0 | } |
992 | | |
993 | | #undef xmlPedanticParserDefaultValue |
994 | | int * |
995 | 18.3k | __xmlPedanticParserDefaultValue(void) { |
996 | 18.3k | if (IS_MAIN_THREAD) |
997 | 18.3k | return (&xmlPedanticParserDefaultValue); |
998 | 0 | else |
999 | 0 | return (&xmlGetGlobalState()->xmlPedanticParserDefaultValue); |
1000 | 18.3k | } |
1001 | 0 | int xmlThrDefPedanticParserDefaultValue(int v) { |
1002 | 0 | int ret; |
1003 | 0 | xmlMutexLock(xmlThrDefMutex); |
1004 | 0 | ret = xmlPedanticParserDefaultValueThrDef; |
1005 | 0 | xmlPedanticParserDefaultValueThrDef = v; |
1006 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
1007 | 0 | return ret; |
1008 | 0 | } |
1009 | | |
1010 | | #undef xmlSaveNoEmptyTags |
1011 | | int * |
1012 | 0 | __xmlSaveNoEmptyTags(void) { |
1013 | 0 | if (IS_MAIN_THREAD) |
1014 | 0 | return (&xmlSaveNoEmptyTags); |
1015 | 0 | else |
1016 | 0 | return (&xmlGetGlobalState()->xmlSaveNoEmptyTags); |
1017 | 0 | } |
1018 | 0 | int xmlThrDefSaveNoEmptyTags(int v) { |
1019 | 0 | int ret; |
1020 | 0 | xmlMutexLock(xmlThrDefMutex); |
1021 | 0 | ret = xmlSaveNoEmptyTagsThrDef; |
1022 | 0 | xmlSaveNoEmptyTagsThrDef = v; |
1023 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
1024 | 0 | return ret; |
1025 | 0 | } |
1026 | | |
1027 | | #undef xmlSubstituteEntitiesDefaultValue |
1028 | | int * |
1029 | 18.3k | __xmlSubstituteEntitiesDefaultValue(void) { |
1030 | 18.3k | if (IS_MAIN_THREAD) |
1031 | 18.3k | return (&xmlSubstituteEntitiesDefaultValue); |
1032 | 0 | else |
1033 | 0 | return (&xmlGetGlobalState()->xmlSubstituteEntitiesDefaultValue); |
1034 | 18.3k | } |
1035 | 0 | int xmlThrDefSubstituteEntitiesDefaultValue(int v) { |
1036 | 0 | int ret; |
1037 | 0 | xmlMutexLock(xmlThrDefMutex); |
1038 | 0 | ret = xmlSubstituteEntitiesDefaultValueThrDef; |
1039 | 0 | xmlSubstituteEntitiesDefaultValueThrDef = v; |
1040 | 0 | xmlMutexUnlock(xmlThrDefMutex); |
1041 | 0 | return ret; |
1042 | 0 | } |
1043 | | |
1044 | | #undef xmlRegisterNodeDefaultValue |
1045 | | xmlRegisterNodeFunc * |
1046 | 0 | __xmlRegisterNodeDefaultValue(void) { |
1047 | 0 | if (IS_MAIN_THREAD) |
1048 | 0 | return (&xmlRegisterNodeDefaultValue); |
1049 | 0 | else |
1050 | 0 | return (&xmlGetGlobalState()->xmlRegisterNodeDefaultValue); |
1051 | 0 | } |
1052 | | |
1053 | | #undef xmlDeregisterNodeDefaultValue |
1054 | | xmlDeregisterNodeFunc * |
1055 | 0 | __xmlDeregisterNodeDefaultValue(void) { |
1056 | 0 | if (IS_MAIN_THREAD) |
1057 | 0 | return (&xmlDeregisterNodeDefaultValue); |
1058 | 0 | else |
1059 | 0 | return (&xmlGetGlobalState()->xmlDeregisterNodeDefaultValue); |
1060 | 0 | } |
1061 | | |
1062 | | #undef xmlParserInputBufferCreateFilenameValue |
1063 | | xmlParserInputBufferCreateFilenameFunc * |
1064 | 0 | __xmlParserInputBufferCreateFilenameValue(void) { |
1065 | 0 | if (IS_MAIN_THREAD) |
1066 | 0 | return (&xmlParserInputBufferCreateFilenameValue); |
1067 | 0 | else |
1068 | 0 | return (&xmlGetGlobalState()->xmlParserInputBufferCreateFilenameValue); |
1069 | 0 | } |
1070 | | |
1071 | | #undef xmlOutputBufferCreateFilenameValue |
1072 | | xmlOutputBufferCreateFilenameFunc * |
1073 | 0 | __xmlOutputBufferCreateFilenameValue(void) { |
1074 | 0 | if (IS_MAIN_THREAD) |
1075 | 0 | return (&xmlOutputBufferCreateFilenameValue); |
1076 | 0 | else |
1077 | 0 | return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue); |
1078 | 0 | } |
1079 | | |