* xmlInitParser: * * Initialization function for the XML parser. * * Call once from the main thread before using the library in * multithreaded programs. */
| 566 | * multithreaded programs. |
| 567 | */ |
| 568 | void |
| 569 | xmlInitParser(void) { |
| 570 | /* |
| 571 | * Note that the initialization code must not make memory allocations. |
| 572 | */ |
| 573 | if (xmlParserInitialized != 0) |
| 574 | return; |
| 575 | |
| 576 | xmlGlobalInitMutexLock(); |
| 577 | |
| 578 | if (xmlParserInnerInitialized == 0) { |
| 579 | #if defined(_WIN32) && \ |
| 580 | !defined(LIBXML_THREAD_ALLOC_ENABLED) && \ |
| 581 | (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) |
| 582 | if (xmlFree == free) |
| 583 | atexit(xmlCleanupParser); |
| 584 | #endif |
| 585 | |
| 586 | xmlInitRandom(); /* Required by xmlInitGlobalsInternal */ |
| 587 | xmlInitMemoryInternal(); |
| 588 | xmlInitGlobalsInternal(); |
| 589 | xmlInitDictInternal(); |
| 590 | xmlInitEncodingInternal(); |
| 591 | #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) |
| 592 | xmlInitXPathInternal(); |
| 593 | #endif |
| 594 | xmlInitIOCallbacks(); |
| 595 | |
| 596 | xmlParserInnerInitialized = 1; |
| 597 | } |
| 598 | |
| 599 | xmlGlobalInitMutexUnlock(); |
| 600 | |
| 601 | xmlParserInitialized = 1; |
| 602 | } |
| 603 | |
| 604 | /** |
| 605 | * xmlCleanupParser: |