ReactOS 0.4.15-dev-7931-gfd331f1
libxml.h File Reference
#include "config.h"
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#include <stdio.h>
Include dependency graph for libxml.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _LARGEFILE_SOURCE
 
#define _FILE_OFFSET_BITS   64
 
#define SYSCONFDIR   "/etc"
 
#define XML_IGNORE_PEDANTIC_WARNINGS
 
#define XML_POP_WARNINGS
 
#define ATTRIBUTE_NO_SANITIZE(arg)
 
#define LIBXML_STATIC
 

Functions

void __xmlIOErr (int domain, int code, const char *extra)
 
void __xmlLoaderErr (void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2
 
void void __xmlGlobalInitMutexLock (void)
 
void __xmlGlobalInitMutexUnlock (void)
 
void __xmlGlobalInitMutexDestroy (void)
 
int __xmlInitializeDict (void)
 
int __xmlRandom (void)
 
XMLPUBFUN xmlChar *XMLCALL xmlEscapeFormatString (xmlChar **msg)
 
int xmlInputReadCallbackNop (void *context, char *buffer, int len)
 

Variables

int __xmlRegisterCallbacks
 

Macro Definition Documentation

◆ _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS   64

Definition at line 21 of file libxml.h.

◆ _LARGEFILE_SOURCE

#define _LARGEFILE_SOURCE

Definition at line 18 of file libxml.h.

◆ ATTRIBUTE_NO_SANITIZE

#define ATTRIBUTE_NO_SANITIZE (   arg)

Definition at line 74 of file libxml.h.

◆ LIBXML_STATIC

#define LIBXML_STATIC

Definition at line 114 of file libxml.h.

◆ SYSCONFDIR

#define SYSCONFDIR   "/etc"

Definition at line 35 of file libxml.h.

◆ XML_IGNORE_PEDANTIC_WARNINGS

#define XML_IGNORE_PEDANTIC_WARNINGS

Definition at line 66 of file libxml.h.

◆ XML_POP_WARNINGS

#define XML_POP_WARNINGS

Definition at line 67 of file libxml.h.

Function Documentation

◆ __xmlGlobalInitMutexDestroy()

void __xmlGlobalInitMutexDestroy ( void  )

xmlGlobalInitMutexDestroy

Makes sure that the global initialization mutex is destroyed before application termination.

Definition at line 512 of file threads.c.

513{
514#ifdef HAVE_PTHREAD_H
515#elif defined HAVE_WIN32_THREADS
516 if (global_init_lock != NULL) {
517 DeleteCriticalSection(global_init_lock);
518 free(global_init_lock);
519 global_init_lock = NULL;
520 }
521#endif
522}
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by xmlCleanupGlobals().

◆ __xmlGlobalInitMutexLock()

void void __xmlGlobalInitMutexLock ( void  )

xmlGlobalInitMutexLock

Makes sure that the global initialization mutex is initialized and locks it.

Definition at line 413 of file threads.c.

414{
415 /* Make sure the global init lock is initialized and then lock it. */
416#ifdef HAVE_PTHREAD_H
417 /* The mutex is statically initialized, so we just lock it. */
418#ifdef XML_PTHREAD_WEAK
419 if (pthread_mutex_lock == NULL)
420 return;
421#endif /* XML_PTHREAD_WEAK */
422 pthread_mutex_lock(&global_init_lock);
423#elif defined HAVE_WIN32_THREADS
425
426 /* Create a new critical section */
427 if (global_init_lock == NULL) {
428 cs = malloc(sizeof(CRITICAL_SECTION));
429 if (cs == NULL) {
431 "xmlGlobalInitMutexLock: out of memory\n");
432 return;
433 }
435
436 /* Swap it into the global_init_lock */
437#ifdef InterlockedCompareExchangePointer
438 InterlockedCompareExchangePointer((void **) &global_init_lock,
439 cs, NULL);
440#else /* Use older void* version */
441 InterlockedCompareExchange((void **) &global_init_lock,
442 (void *) cs, NULL);
443#endif /* InterlockedCompareExchangePointer */
444
445 /* If another thread successfully recorded its critical
446 * section in the global_init_lock then discard the one
447 * allocated by this thread. */
448 if (global_init_lock != cs) {
450 free(cs);
451 }
452 }
453
454 /* Lock the chosen critical section */
455 EnterCriticalSection(global_init_lock);
456#elif defined HAVE_BEOS_THREADS
457 int32 sem;
458
459 /* Allocate a new semaphore */
460 sem = create_sem(1, "xmlGlobalinitMutex");
461
462 while (global_init_lock == -1) {
463 if (atomic_add(&global_init_count, 1) == 0) {
464 global_init_lock = sem;
465 } else {
466 snooze(1);
467 atomic_add(&global_init_count, -1);
468 }
469 }
470
471 /* If another thread successfully recorded its critical
472 * section in the global_init_lock then discard the one
473 * allocated by this thread. */
474 if (global_init_lock != sem)
475 delete_sem(sem);
476
477 /* Acquire the chosen semaphore */
478 if (acquire_sem(global_init_lock) != B_NO_ERROR) {
479#ifdef DEBUG_THREADS
481 "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
482#endif
483 }
484#endif
485}
static void atomic_add(int volatile i, atomic_t volatile *v)
Definition: atomic.h:43
#define malloc
Definition: debug_ros.c:4
long int32
Definition: platform.h:12
#define cs
Definition: i386-dis.c:442
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define InterlockedCompareExchange
Definition: interlocked.h:104
static HANDLE sem
Definition: sync.c:674
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:353
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:337
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by xmlInitParser().

◆ __xmlGlobalInitMutexUnlock()

void __xmlGlobalInitMutexUnlock ( void  )

Definition at line 488 of file threads.c.

489{
490#ifdef HAVE_PTHREAD_H
491#ifdef XML_PTHREAD_WEAK
492 if (pthread_mutex_unlock == NULL)
493 return;
494#endif /* XML_PTHREAD_WEAK */
495 pthread_mutex_unlock(&global_init_lock);
496#elif defined HAVE_WIN32_THREADS
497 if (global_init_lock != NULL) {
498 LeaveCriticalSection(global_init_lock);
499 }
500#elif defined HAVE_BEOS_THREADS
501 release_sem(global_init_lock);
502#endif
503}
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by xmlInitParser().

◆ __xmlInitializeDict()

int __xmlInitializeDict ( void  )

__xmlInitializeDict:

This function is not public Do the dictionary mutex initialization. this function is not thread safe, initialization should normally be done once at setup when called from xmlOnceInit() we may also land in this code if thread support is not compiled in

Returns 0 if initialization was already done, and 1 if that call led to the initialization

Definition at line 173 of file dict.c.

173 {
175 return(1);
176
177 if ((xmlDictMutex = xmlNewMutex()) == NULL)
178 return(0);
180
181#ifdef DICT_RANDOMIZATION
182#ifdef HAVE_RAND_R
183 rand_seed = time(NULL);
184 rand_r(& rand_seed);
185#else
186 srand(time(NULL));
187#endif
188#endif
191 return(1);
192}
void __cdecl srand(_In_ unsigned int _Seed)
__u16 time
Definition: mkdosfs.c:8
static xmlMutexPtr xmlDictMutex
Definition: dict.c:130
static int xmlDictInitialized
Definition: dict.c:135
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:248
XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex(void)
Definition: threads.c:168
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:220

Referenced by __xmlRandom(), xmlDictCreate(), xmlDictFree(), and xmlDictReference().

◆ __xmlIOErr()

void __xmlIOErr ( int  domain,
int  code,
const char extra 
)

◆ __xmlLoaderErr()

void __xmlLoaderErr ( void ctx,
const char msg,
const char filename 
)

Referenced by xmlNewInputFromFile().

◆ __xmlRandom()

int __xmlRandom ( void  )

Definition at line 195 of file dict.c.

195 {
196 int ret;
197
198 if (xmlDictInitialized == 0)
200
202#ifdef HAVE_RAND_R
203 ret = rand_r(& rand_seed);
204#else
205 ret = rand();
206#endif
208 return(ret);
209}
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
int __xmlInitializeDict(void)
Definition: dict.c:173
int ret

Referenced by xmlDictCreate(), and xmlHashCreate().

◆ xmlEscapeFormatString()

XMLPUBFUN xmlChar *XMLCALL xmlEscapeFormatString ( xmlChar **  msg)

xmlEscapeFormatString: @msg: a pointer to the string in which to escape '' characters. Must be a heap-allocated buffer created by libxml2 that may be returned, or that may be freed and replaced.

Replaces the string pointed to by 'msg' with an escaped string. Returns the same string with all '' characters escaped.

Definition at line 1001 of file xmlstring.c.

1002{
1003 xmlChar *msgPtr = NULL;
1004 xmlChar *result = NULL;
1005 xmlChar *resultPtr = NULL;
1006 size_t count = 0;
1007 size_t msgLen = 0;
1008 size_t resultLen = 0;
1009
1010 if (!msg || !*msg)
1011 return(NULL);
1012
1013 for (msgPtr = *msg; *msgPtr != '\0'; ++msgPtr) {
1014 ++msgLen;
1015 if (*msgPtr == '%')
1016 ++count;
1017 }
1018
1019 if (count == 0)
1020 return(*msg);
1021
1022 if ((count > INT_MAX) || (msgLen > INT_MAX - count))
1023 return(NULL);
1024 resultLen = msgLen + count + 1;
1025 result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
1026 if (result == NULL) {
1027 /* Clear *msg to prevent format string vulnerabilities in
1028 out-of-memory situations. */
1029 xmlFree(*msg);
1030 *msg = NULL;
1032 return(NULL);
1033 }
1034
1035 for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
1036 *resultPtr = *msgPtr;
1037 if (*msgPtr == '%')
1038 *(++resultPtr) = '%';
1039 }
1040 result[resultLen - 1] = '\0';
1041
1042 xmlFree(*msg);
1043 *msg = result;
1044
1045 return *msg;
1046}
#define msg(x)
Definition: auth_time.c:54
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint64EXT * result
Definition: glext.h:11304
#define INT_MAX
Definition: limits.h:40
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
Definition: globals.h:249
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:251
unsigned char xmlChar
Definition: xmlstring.h:28

◆ xmlInputReadCallbackNop()

int xmlInputReadCallbackNop ( void context,
char buffer,
int  len 
)

Referenced by xmlGROW().

Variable Documentation

◆ __xmlRegisterCallbacks