ReactOS  0.4.13-dev-259-g5ca9c9c
libxml.h File Reference
#include <libxml/xmlstring.h>
#include "config.h"
#include <libxml/xmlversion.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 XML_IGNORE_PEDANTIC_WARNINGS
 
#define XML_POP_WARNINGS
 
#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 19 of file libxml.h.

◆ _LARGEFILE_SOURCE

#define _LARGEFILE_SOURCE

Definition at line 16 of file libxml.h.

◆ LIBXML_STATIC

#define LIBXML_STATIC

Definition at line 125 of file libxml.h.

◆ XML_IGNORE_PEDANTIC_WARNINGS

#define XML_IGNORE_PEDANTIC_WARNINGS

Definition at line 71 of file libxml.h.

◆ XML_POP_WARNINGS

#define XML_POP_WARNINGS

Definition at line 72 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 526 of file threads.c.

527 {
528 #ifdef HAVE_PTHREAD_H
529 #elif defined HAVE_WIN32_THREADS
530  if (global_init_lock != NULL) {
531  DeleteCriticalSection(global_init_lock);
532  free(global_init_lock);
533  global_init_lock = NULL;
534  }
535 #endif
536 }
#define free
Definition: debug_ros.c:5
smooth NULL
Definition: ftsmooth.c:416
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 427 of file threads.c.

428 {
429  /* Make sure the global init lock is initialized and then lock it. */
430 #ifdef HAVE_PTHREAD_H
431  /* The mutex is statically initialized, so we just lock it. */
432 #ifdef XML_PTHREAD_WEAK
433  if (pthread_mutex_lock == NULL)
434  return;
435 #endif /* XML_PTHREAD_WEAK */
436  pthread_mutex_lock(&global_init_lock);
437 #elif defined HAVE_WIN32_THREADS
439 
440  /* Create a new critical section */
441  if (global_init_lock == NULL) {
442  cs = malloc(sizeof(CRITICAL_SECTION));
443  if (cs == NULL) {
445  "xmlGlobalInitMutexLock: out of memory\n");
446  return;
447  }
449 
450  /* Swap it into the global_init_lock */
451 #ifdef InterlockedCompareExchangePointer
452  InterlockedCompareExchangePointer((void **) &global_init_lock,
453  cs, NULL);
454 #else /* Use older void* version */
455  InterlockedCompareExchange((void **) &global_init_lock,
456  (void *) cs, NULL);
457 #endif /* InterlockedCompareExchangePointer */
458 
459  /* If another thread successfully recorded its critical
460  * section in the global_init_lock then discard the one
461  * allocated by this thread. */
462  if (global_init_lock != cs) {
464  free(cs);
465  }
466  }
467 
468  /* Lock the chosen critical section */
469  EnterCriticalSection(global_init_lock);
470 #elif defined HAVE_BEOS_THREADS
471  int32 sem;
472 
473  /* Allocate a new semaphore */
474  sem = create_sem(1, "xmlGlobalinitMutex");
475 
476  while (global_init_lock == -1) {
477  if (atomic_add(&global_init_count, 1) == 0) {
478  global_init_lock = sem;
479  } else {
480  snooze(1);
481  atomic_add(&global_init_count, -1);
482  }
483  }
484 
485  /* If another thread successfully recorded its critical
486  * section in the global_init_lock then discard the one
487  * allocated by this thread. */
488  if (global_init_lock != sem)
489  delete_sem(sem);
490 
491  /* Acquire the chosen semaphore */
492  if (acquire_sem(global_init_lock) != B_NO_ERROR) {
493 #ifdef DEBUG_THREADS
495  "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
496 #endif
497  }
498 #endif
499 }
#define free
Definition: debug_ros.c:5
#define InterlockedCompareExchange
Definition: interlocked.h:104
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
uint32_t cs
Definition: isohybrid.c:75
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static void atomic_add(int volatile i, atomic_t volatile *v)
Definition: atomic.h:43
static HANDLE sem
Definition: sync.c:677
long int32
Definition: platform.h:12
#define malloc
Definition: debug_ros.c:4
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlInitParser().

◆ __xmlGlobalInitMutexUnlock()

void __xmlGlobalInitMutexUnlock ( void  )

Definition at line 502 of file threads.c.

503 {
504 #ifdef HAVE_PTHREAD_H
505 #ifdef XML_PTHREAD_WEAK
506  if (pthread_mutex_unlock == NULL)
507  return;
508 #endif /* XML_PTHREAD_WEAK */
509  pthread_mutex_unlock(&global_init_lock);
510 #elif defined HAVE_WIN32_THREADS
511  if (global_init_lock != NULL) {
512  LeaveCriticalSection(global_init_lock);
513  }
514 #elif defined HAVE_BEOS_THREADS
515  release_sem(global_init_lock);
516 #endif
517 }
smooth NULL
Definition: ftsmooth.c:416
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 175 of file dict.c.

175  {
176  if (xmlDictInitialized)
177  return(1);
178 
179  if ((xmlDictMutex = xmlNewRMutex()) == NULL)
180  return(0);
182 
183 #ifdef DICT_RANDOMIZATION
184 #ifdef HAVE_RAND_R
185  rand_seed = time(NULL);
186  rand_r(& rand_seed);
187 #else
188  srand(time(NULL));
189 #endif
190 #endif
191  xmlDictInitialized = 1;
193  return(1);
194 }
XMLPUBFUN xmlRMutexPtr XMLCALL xmlNewRMutex(void)
Definition: threads.c:285
XMLPUBFUN void XMLCALL xmlRMutexLock(xmlRMutexPtr tok)
Definition: threads.c:343
void __cdecl srand(_In_ unsigned int _Seed)
static int xmlDictInitialized
Definition: dict.c:139
__u16 time
Definition: mkdosfs.c:366
smooth NULL
Definition: ftsmooth.c:416
static xmlRMutexPtr xmlDictMutex
Definition: dict.c:134
XMLPUBFUN void XMLCALL xmlRMutexUnlock(xmlRMutexPtr tok)
Definition: threads.c:388

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 197 of file dict.c.

197  {
198  int ret;
199 
200  if (xmlDictInitialized == 0)
202 
204 #ifdef HAVE_RAND_R
205  ret = rand_r(& rand_seed);
206 #else
207  ret = rand();
208 #endif
210  return(ret);
211 }
XMLPUBFUN void XMLCALL xmlRMutexLock(xmlRMutexPtr tok)
Definition: threads.c:343
static int xmlDictInitialized
Definition: dict.c:139
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
static xmlRMutexPtr xmlDictMutex
Definition: dict.c:134
int __xmlInitializeDict(void)
Definition: dict.c:175
XMLPUBFUN void XMLCALL xmlRMutexUnlock(xmlRMutexPtr tok)
Definition: threads.c:388
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  resultLen = msgLen + count + 1;
1023  result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
1024  if (result == NULL) {
1025  /* Clear *msg to prevent format string vulnerabilities in
1026  out-of-memory situations. */
1027  xmlFree(*msg);
1028  *msg = NULL;
1030  return(NULL);
1031  }
1032 
1033  for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
1034  *resultPtr = *msgPtr;
1035  if (*msgPtr == '%')
1036  *(++resultPtr) = '%';
1037  }
1038  result[resultLen - 1] = '\0';
1039 
1040  xmlFree(*msg);
1041  *msg = result;
1042 
1043  return *msg;
1044 }
XMLPUBVAR xmlMallocFunc xmlMallocAtomic
Definition: globals.h:248
GLuint GLuint GLsizei count
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
unsigned char xmlChar
Definition: xmlstring.h:28
#define msg(x)
Definition: auth_time.c:54
GLuint64EXT * result
Definition: glext.h:11304

◆ xmlInputReadCallbackNop()

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

Referenced by xmlGROW().

Variable Documentation

◆ __xmlRegisterCallbacks