VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/globals.c@ 20364

最後變更 在這個檔案從20364是 6076,由 vboxsync 提交於 17 年 前

Merged dmik/s2 branch (r25959:26751) to the trunk.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette