| 756 | #endif /* LIBXML_STATIC */ |
| 757 | |
| 758 | static void |
| 759 | xmlInitGlobalState(xmlGlobalStatePtr gs) { |
| 760 | xmlMutexLock(&xmlThrDefMutex); |
| 761 | |
| 762 | #ifdef LIBXML_THREAD_ENABLED |
| 763 | gs->localRngState[0] = xmlGlobalRandom(); |
| 764 | gs->localRngState[1] = xmlGlobalRandom(); |
| 765 | #endif |
| 766 | |
| 767 | gs->gs_xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef; |
| 768 | gs->gs_xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef; |
| 769 | gs->gs_xmlDoValidityCheckingDefaultValue = |
| 770 | xmlDoValidityCheckingDefaultValueThrDef; |
| 771 | #ifdef LIBXML_THREAD_ALLOC_ENABLED |
| 772 | gs->gs_xmlFree = free; |
| 773 | gs->gs_xmlMalloc = malloc; |
| 774 | gs->gs_xmlMallocAtomic = malloc; |
| 775 | gs->gs_xmlRealloc = realloc; |
| 776 | gs->gs_xmlMemStrdup = xmlPosixStrdup; |
| 777 | #endif |
| 778 | gs->gs_xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef; |
| 779 | #ifdef LIBXML_OUTPUT_ENABLED |
| 780 | gs->gs_xmlIndentTreeOutput = xmlIndentTreeOutputThrDef; |
| 781 | gs->gs_xmlTreeIndentString = xmlTreeIndentStringThrDef; |
| 782 | gs->gs_xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; |
| 783 | #endif |
| 784 | gs->gs_xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef; |
| 785 | gs->gs_xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; |
| 786 | gs->gs_xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; |
| 787 | gs->gs_xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; |
| 788 | gs->gs_xmlSubstituteEntitiesDefaultValue = |
| 789 | xmlSubstituteEntitiesDefaultValueThrDef; |
| 790 | |
| 791 | gs->gs_xmlGenericError = xmlGenericErrorThrDef; |
| 792 | gs->gs_xmlStructuredError = xmlStructuredErrorThrDef; |
| 793 | gs->gs_xmlGenericErrorContext = xmlGenericErrorContextThrDef; |
| 794 | gs->gs_xmlStructuredErrorContext = xmlStructuredErrorContextThrDef; |
| 795 | gs->gs_xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; |
| 796 | gs->gs_xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; |
| 797 | |
| 798 | gs->gs_xmlParserInputBufferCreateFilenameValue = |
| 799 | xmlParserInputBufferCreateFilenameValueThrDef; |
| 800 | gs->gs_xmlOutputBufferCreateFilenameValue = |
| 801 | xmlOutputBufferCreateFilenameValueThrDef; |
| 802 | memset(&gs->gs_xmlLastError, 0, sizeof(xmlError)); |
| 803 | |
| 804 | xmlMutexUnlock(&xmlThrDefMutex); |
| 805 | |
| 806 | #ifdef HAVE_POSIX_THREADS |
| 807 | pthread_setspecific(globalkey, gs); |
| 808 | #elif defined HAVE_WIN32_THREADS |
| 809 | #ifndef USE_TLS |
| 810 | TlsSetValue(globalkey, gs); |
| 811 | #endif |
| 812 | #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL) |
| 813 | xmlRegisterGlobalStateDtor(gs); |
| 814 | #endif |
| 815 | #endif |
no test coverage detected