diff --git a/ChangeLog b/ChangeLog index 52bc538c..935330b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Sep 2 14:26:43 CEST 2005 Daniel Veillard + + * encoding.c parserInternals.c: avoid passing a char[] as snprintf + first argument. + * threads.c include/libxml/threads.h: implemented xmlIsThreadsEnabled() + based on Andrew W. Nosenko idea. + * doc/* elfgcchack.h: regenerated the API + Thu Sep 1 14:44:42 CEST 2005 Daniel Veillard * configure.in: the use of AM_PATH_PYTHON is not portable enough diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index 161b4ef2..c5083f07 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -52,6 +52,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathOrderDocElems
about
_xmlParserCtxt
xmlDebugDumpString
+xmlIsThreadsEnabled
xmlShellDir
xmlTextWriterWriteRawLen
above
xmlParseMarkupDecl
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index e818ee7e..e3451a00 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -419,6 +419,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlExpDump
xmlExpMaxToken
xmlGetLastError
+xmlIsThreadsEnabled
xmlPatterncompile
xmlRegexpCompile
xmlRegexpExec
diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index 78fd4a81..fc36d543 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -113,7 +113,8 @@ A:link, A:visited, A:active { text-decoration: underline }
emitted
xmlSetGenericErrorFunc
empty-element
xmlParseStartTag
enable
xmlCatalogSetDebug
-
enabled
xmlSaveFile
+
enabled
xmlIsThreadsEnabled
+xmlSaveFile
xmlSaveFormatFile
enabling
xmlLineNumbersDefault
xmlPedanticParserDefault
diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html index b797ffda..403c5b05 100644 --- a/doc/APIchunk17.html +++ b/doc/APIchunk17.html @@ -279,6 +279,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDebugDumpNode
xmlDebugDumpNodeList
xmlDebugDumpOneNode
+xmlIsThreadsEnabled
xmlNanoFTPUpdateURL
xmlNanoHTTPFetch
xmlNanoHTTPMethod
diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html index f02b4d03..21013fd1 100644 --- a/doc/APIchunk18.html +++ b/doc/APIchunk18.html @@ -223,6 +223,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCleanupThreads
xmlInitThreads
xmlInitializeGlobalState
+xmlIsThreadsEnabled
xmlLockLibrary
xmlModuleFree
xmlModuleOpen
diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index ade66183..5e4b9d07 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -307,6 +307,7 @@ A:link, A:visited, A:active { text-decoration: underline }
multiple
xmlCurrentChar
xmlStringCurrentChar
multiply
xmlXPathMultValues
+
multithread
xmlIsThreadsEnabled
multithreaded
htmlInitAutoClose
xmlInitParser
mutex
xmlDictCleanup
diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index 1433661e..69026ab6 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -240,6 +240,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Reverse
xmlListReverse
Root
xmlParseDocTypeDecl
xmlValidateRoot
+
Run-time
xmlIsThreadsEnabled
Runic
xmlUCSIsRunic

A-B C-C diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 7cdd7f23..6f740218 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -1202,6 +1202,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlGetThreadId
xmlInitThreads
xmlIsMainThread
+xmlIsThreadsEnabled
xmlLockLibrary
xmlMutex
xmlMutexLock
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 7abb56c4..fd58561f 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -2084,6 +2084,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIsPubidChar_ch
xmlIsPubidChar_tab
xmlIsRef
+xmlIsThreadsEnabled
xmlIsXHTML
xmlKeepBlanksDefault
xmlKeepBlanksDefaultValue
diff --git a/doc/html/libxml-threads.html b/doc/html/libxml-threads.html index 7df283b0..8d79db42 100644 --- a/doc/html/libxml-threads.html +++ b/doc/html/libxml-threads.html @@ -23,6 +23,7 @@ The content of this structure is not made public by the API.
int	xmlGetThreadId			(void)
void	xmlInitThreads			(void)
int	xmlIsMainThread			(void)
+
int	xmlIsThreadsEnabled		(void)
void	xmlLockLibrary			(void)
void	xmlMutexLock			(xmlMutexPtr tok)
void	xmlMutexUnlock			(xmlMutexPtr tok)
@@ -50,7 +51,9 @@ The content of this structure is not made public by the API.

xmlInitThreads() is used to to initialize all the thread related data of the libxml2 library.

Function: xmlIsMainThread

int	xmlIsMainThread			(void)

xmlIsMainThread() check whether the current thread is the main thread.

-
Returns:1 if the current thread is the main thread, 0 otherwise

Function: xmlLockLibrary

void	xmlLockLibrary			(void)
+
Returns:1 if the current thread is the main thread, 0 otherwise

Function: xmlIsThreadsEnabled

int	xmlIsThreadsEnabled		(void)
+

Run-time information about whether multithread support is compiled in

+
Returns:1 (true) if library was compiled with multithread support enabled or 0 (false) otherwise.

Function: xmlLockLibrary

void	xmlLockLibrary			(void)

xmlLockLibrary() is used to take out a re-entrant lock on the libxml2 library.

Function: xmlMutexLock

void	xmlMutexLock			(xmlMutexPtr tok)

xmlMutexLock() is used to lock a libxml2 token.

diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 74135d5c..985677b9 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1329,6 +1329,7 @@ + interfaces for tree manipulation @@ -10254,6 +10255,10 @@ actually an xmlCharEncoding'/> + + Run-time information about whether multithread support is compiled in + + Try to find if the document correspond to an XHTML DTD diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index 88ac06c3..6ee67e48 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -2078,6 +2078,7 @@ + @@ -5553,6 +5554,7 @@ + @@ -11540,6 +11542,7 @@ + @@ -16930,6 +16933,9 @@ + + + @@ -18081,6 +18087,7 @@ + @@ -19752,6 +19759,7 @@ + @@ -21300,6 +21308,7 @@ + @@ -23115,6 +23124,7 @@ + @@ -23748,6 +23758,7 @@ + @@ -24429,6 +24440,9 @@ + + + diff --git a/elfgcchack.h b/elfgcchack.h index ca69dbf1..eef3f9ab 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -4695,6 +4695,16 @@ extern __typeof (xmlIsRef) xmlIsRef__internal_alias __attribute((visibility("hid #endif #endif +#ifdef bottom_threads +#undef xmlIsThreadsEnabled +extern __typeof (xmlIsThreadsEnabled) xmlIsThreadsEnabled __attribute((alias("xmlIsThreadsEnabled__internal_alias"))); +#else +#ifndef xmlIsThreadsEnabled +extern __typeof (xmlIsThreadsEnabled) xmlIsThreadsEnabled__internal_alias __attribute((visibility("hidden"))); +#define xmlIsThreadsEnabled xmlIsThreadsEnabled__internal_alias +#endif +#endif + #ifdef bottom_xmlsave #undef xmlIsXHTML extern __typeof (xmlIsXHTML) xmlIsXHTML __attribute((alias("xmlIsXHTML__internal_alias"))); diff --git a/encoding.c b/encoding.c index 16f03ac6..c6cfe919 100644 --- a/encoding.c +++ b/encoding.c @@ -1905,7 +1905,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, case -2: { char buf[50]; - snprintf(buf, 49, "0x%02X 0x%02X 0x%02X 0x%02X", + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", in->content[0], in->content[1], in->content[2], in->content[3]); buf[49] = 0; @@ -2077,7 +2077,7 @@ retry: * and continue the transcoding phase, hoping the error * did not mangle the encoder state. */ - snprintf((char *) charref, sizeof(charref), "&#%d;", cur); + snprintf((char *) &charref[0], sizeof(charref), "&#%d;", cur); xmlBufferShrink(in, len); xmlBufferAddHead(in, charref, -1); @@ -2085,7 +2085,7 @@ retry: } else { char buf[50]; - snprintf(buf, 49, "0x%02X 0x%02X 0x%02X 0x%02X", + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", in->content[0], in->content[1], in->content[2], in->content[3]); buf[49] = 0; diff --git a/include/libxml/threads.h b/include/libxml/threads.h index fb6b7048..f954d160 100644 --- a/include/libxml/threads.h +++ b/include/libxml/threads.h @@ -36,7 +36,6 @@ typedef xmlRMutex *xmlRMutexPtr; #ifdef __cplusplus extern "C" { #endif - XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex (void); XMLPUBFUN void XMLCALL @@ -58,6 +57,8 @@ XMLPUBFUN void XMLCALL /* * Library wide APIs. */ +XMLPUBFUN int XMLCALL + xmlIsThreadsEnabled(void); XMLPUBFUN void XMLCALL xmlInitThreads (void); XMLPUBFUN void XMLCALL diff --git a/parserInternals.c b/parserInternals.c index 6ec8d4bc..f3fcd6f3 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -728,7 +728,7 @@ encoding_error: { char buffer[150]; - snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", ctxt->input->cur[0], ctxt->input->cur[1], ctxt->input->cur[2], ctxt->input->cur[3]); __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, diff --git a/threads.c b/threads.c index 90a461ae..f1a5314a 100644 --- a/threads.c +++ b/threads.c @@ -164,6 +164,24 @@ static xmlRMutexPtr xmlLibraryLock = NULL; static void xmlOnceInit(void); #endif +/** + * xmlIsThreadsEnabled: + * + * Run-time information about whether multithread support is compiled in + * + * Returns 1 (true) if library was compiled with multithread support + * enabled or 0 (false) otherwise. + */ +int +xmlIsThreadsEnabled(void) +{ +#ifdef LIBXML_THREAD_ENABLED + return 1; +#else + return 0; +#endif +} + /** * xmlNewMutex: * diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index f28a6280..bf3cf76b 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -996,6 +996,7 @@ xmlIsMainThread xmlIsMixedElement xmlIsPubidChar xmlIsRef +xmlIsThreadsEnabled #ifdef LIBXML_HTML_ENABLED xmlIsXHTML #endif