Example #1
0
int xmlThrDefIndentTreeOutput(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlIndentTreeOutputThrDef;
    xmlIndentTreeOutputThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #2
0
const char * xmlThrDefTreeIndentString(const char * v) {
    const char * ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlTreeIndentStringThrDef;
    xmlTreeIndentStringThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #3
0
int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlSubstituteEntitiesDefaultValueThrDef;
    xmlSubstituteEntitiesDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #4
0
int xmlThrDefGetWarningsDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlGetWarningsDefaultValueThrDef;
    xmlGetWarningsDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #5
0
int xmlThrDefPedanticParserDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlPedanticParserDefaultValueThrDef;
    xmlPedanticParserDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #6
0
int xmlThrDefSaveNoEmptyTags(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlSaveNoEmptyTagsThrDef;
    xmlSaveNoEmptyTagsThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #7
0
int xmlThrDefLoadExtDtdDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlLoadExtDtdDefaultValueThrDef;
    xmlLoadExtDtdDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #8
0
int xmlThrDefParserDebugEntities(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlParserDebugEntitiesThrDef;
    xmlParserDebugEntitiesThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #9
0
void * status_thread() {
	int pwds;
	const short status_sleep = 3;
	while(1) {
		sleep(status_sleep);
		xmlMutexLock(finishedMutex);
		pwds = counter / status_sleep;
		counter = 0;
		if (finished != 0)
			break;
		xmlMutexUnlock(finishedMutex);
		xmlMutexLock(pwdMutex);
		printf("Probing: '%s' [%d pwds/sec]\n", password, pwds);
		xmlMutexUnlock(pwdMutex);
		savestatus();	//FIXME: this is wrong, when probing current password(s) is(are) not finished yet, and the program is exiting
	}
}
Example #10
0
xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
    xmlBufferAllocationScheme ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlBufferAllocSchemeThrDef;
    xmlBufferAllocSchemeThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #11
0
inline char* nextpass() {	//IMPORTANT: the returned string must be freed
   char *ok = malloc(sizeof(char)*(PWD_LEN+1));
   xmlMutexLock(pwdMutex);
   strcpy(ok, password);
   nextpass2((char*) &password, curr_len - 1);
   xmlMutexUnlock(pwdMutex);
   return ok;
}
Example #12
0
int xmlThrDefDefaultBufferSize(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlDefaultBufferSizeThrDef;
    xmlDefaultBufferSizeThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #13
0
int xmlThrDefDoValidityCheckingDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlDoValidityCheckingDefaultValueThrDef;
    xmlDoValidityCheckingDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #14
0
int xmlThrDefLineNumbersDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlLineNumbersDefaultValueThrDef;
    xmlLineNumbersDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #15
0
int xmlThrDefKeepBlanksDefaultValue(int v) {
    int ret;
    xmlMutexLock(xmlThrDefMutex);
    ret = xmlKeepBlanksDefaultValueThrDef;
    xmlKeepBlanksDefaultValueThrDef = v;
    xmlMutexUnlock(xmlThrDefMutex);
    return ret;
}
Example #16
0
void *
xmlMallocAtomicLoc(size_t size, const char * file, int line)
{
  MEMHDR *p;
  void *ret;

  if (!xmlMemInitialized) xmlInitMemory();
#ifdef DEBUG_MEMORY
  xmlGenericError(xmlGenericErrorContext,
                  "Malloc(%d)\n",size);
#endif

  TEST_POINT

  p = (MEMHDR *) malloc(RESERVE_SIZE+size);

  if (!p)
  {
    xmlGenericError(xmlGenericErrorContext,
                    "xmlMallocLoc : Out of free space\n");
    xmlMemoryDump();
    return(NULL);
  }
  p->mh_tag = MEMTAG;
  p->mh_size = size;
  p->mh_type = MALLOC_ATOMIC_TYPE;
  p->mh_file = file;
  p->mh_line = line;
  xmlMutexLock(xmlMemMutex);
  p->mh_number = ++block;
  debugMemSize += size;
  debugMemBlocks++;
  if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
  debugmem_list_add(p);
#endif
  xmlMutexUnlock(xmlMemMutex);

#ifdef DEBUG_MEMORY
  xmlGenericError(xmlGenericErrorContext,
                  "Malloc(%d) Ok\n",size);
#endif

  if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();

  ret = HDR_2_CLIENT(p);

  if (xmlMemTraceBlockAt == ret)
  {
    xmlGenericError(xmlGenericErrorContext,
                    "%p : Malloc(%ld) Ok\n", xmlMemTraceBlockAt, (long)size);
    xmlMallocBreakpoint();
  }

  TEST_POINT

  return(ret);
}
Example #17
0
int
xmlMemUsed(void) {
    int res;

    xmlMutexLock(xmlMemMutex);
    res = debugMemSize;
    xmlMutexUnlock(xmlMemMutex);
    return(res);
}
Example #18
0
int
xmlMemBlocks(void) {
    int res;

    xmlMutexLock(xmlMemMutex);
    res = debugMemBlocks;
    xmlMutexUnlock(xmlMemMutex);
    return(res);
}
Example #19
0
bool House::save()
{
	xmlDocPtr doc;
	xmlNodePtr root, tmp;
	xmlMutexLock(xmlmutex);

	doc = xmlNewDoc((const xmlChar*)"1.0");
	doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"house", NULL);
    root = doc->children;

	std::stringstream sb;
	tmp = xmlNewNode(NULL, (const xmlChar*)"frontdoor");
	sb << frontDoor.x; xmlSetProp(tmp, (const xmlChar*) "x", (const xmlChar*)sb.str().c_str()); sb.str("");
	sb << frontDoor.y; xmlSetProp(tmp, (const xmlChar*) "y", (const xmlChar*)sb.str().c_str()); sb.str("");
	sb << frontDoor.z; xmlSetProp(tmp, (const xmlChar*) "z", (const xmlChar*)sb.str().c_str()); sb.str("");
	xmlAddChild(root, tmp);

	tmp = xmlNewNode(NULL, (const xmlChar*)"owner");
	xmlSetProp(tmp, (const xmlChar*)"name", (const xmlChar*)owner.c_str());
	xmlAddChild(root, tmp);

	for (size_t i = 0; i < subOwners.size(); i++)
	{
		tmp = xmlNewNode(NULL, (const xmlChar*)"subowner");
		xmlSetProp(tmp, (const xmlChar*)"name", (const xmlChar*)subOwners[i].c_str());
		xmlAddChild(root, tmp);
	}

	for (size_t i = 0; i < guests.size(); i++)
	{
		tmp = xmlNewNode(NULL, (const xmlChar*)"guest");
		xmlSetProp(tmp, (const xmlChar*)"name", (const xmlChar*)guests[i].c_str());
		xmlAddChild(root, tmp);
	}

	DoorOwnersMap::const_iterator iter = doorOwners.begin();
	while (iter != doorOwners.end())
	{
		Position pos = iter->first;
		for (size_t i = 0; i < iter->second.size(); i++)
		{
			tmp = xmlNewNode(NULL, (const xmlChar*)"doorowner");	// TODO: optimize
			sb << pos.x; xmlSetProp(tmp, (const xmlChar*) "x", (const xmlChar*)sb.str().c_str()); sb.str("");
			sb << pos.y; xmlSetProp(tmp, (const xmlChar*) "y", (const xmlChar*)sb.str().c_str()); sb.str("");
			sb << pos.z; xmlSetProp(tmp, (const xmlChar*) "z", (const xmlChar*)sb.str().c_str()); sb.str("");
			xmlSetProp(tmp, (const xmlChar*)"name", (const xmlChar*)iter->second[i].c_str());
			xmlAddChild(root, tmp);
		}
		++iter;
	}

	xmlSaveFile(file.c_str(), doc);
    xmlFreeDoc(doc);
	xmlMutexUnlock(xmlmutex);
	return true;
}
Example #20
0
void
xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
    xmlMutexLock(xmlThrDefMutex);
    xmlGenericErrorContextThrDef = ctx;
    if (handler != NULL)
        xmlGenericErrorThrDef = handler;
    else
        xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
    xmlMutexUnlock(xmlThrDefMutex);
}
Example #21
0
void
xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
{
#ifdef MEM_LIST
  MEMHDR *p;
#endif

  if (fp != NULL)
    fprintf(fp,"      MEMORY ALLOCATED : %lu, MAX was %lu\n",
            debugMemSize, debugMaxMemSize);
#ifdef MEM_LIST
  xmlMutexLock(xmlMemMutex);
  if (nr > 0)
  {
    fprintf(fp,"NUMBER   SIZE  TYPE   WHERE\n");
    p = memlist;
    while ((p) && nr > 0)
    {
      fprintf(fp,"%6lu %6lu ",p->mh_number,(unsigned long)p->mh_size);
      switch (p->mh_type)
      {
      case STRDUP_TYPE:
        fprintf(fp,"strdup()  in ");
        break;
      case MALLOC_TYPE:
        fprintf(fp,"malloc()  in ");
        break;
      case MALLOC_ATOMIC_TYPE:
        fprintf(fp,"atomicmalloc()  in ");
        break;
      case REALLOC_TYPE:
        fprintf(fp,"realloc() in ");
        break;
      case REALLOC_ATOMIC_TYPE:
        fprintf(fp,"atomicrealloc() in ");
        break;
      default:
        fprintf(fp,"   ???    in ");
        break;
      }
      if (p->mh_file != NULL)
        fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
      if (p->mh_tag != MEMTAG)
        fprintf(fp,"  INVALID");
      xmlMemContentShow(fp, p);
      fprintf(fp,"\n");
      nr--;
      p = p->mh_next;
    }
  }
  xmlMutexUnlock(xmlMemMutex);
#endif /* MEM_LIST */
}
Example #22
0
char *
xmlMemStrdupLoc(const char *str, const char *file, int line)
{
  char *s;
  size_t size = strlen(str) + 1;
  MEMHDR *p;

  if (!xmlMemInitialized) xmlInitMemory();
  TEST_POINT

  p = (MEMHDR *) malloc(RESERVE_SIZE+size);
  if (!p)
  {
    goto error;
  }
  p->mh_tag = MEMTAG;
  p->mh_size = size;
  p->mh_type = STRDUP_TYPE;
  p->mh_file = file;
  p->mh_line = line;
  xmlMutexLock(xmlMemMutex);
  p->mh_number = ++block;
  debugMemSize += size;
  debugMemBlocks++;
  if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
  debugmem_list_add(p);
#endif
  xmlMutexUnlock(xmlMemMutex);

  s = (char *) HDR_2_CLIENT(p);

  if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();

  if (s != NULL)
    strcpy(s,str);
  else
    goto error;

  TEST_POINT

  if (xmlMemTraceBlockAt == s)
  {
    xmlGenericError(xmlGenericErrorContext,
                    "%p : Strdup() Ok\n", xmlMemTraceBlockAt);
    xmlMallocBreakpoint();
  }

  return(s);

error:
  return(NULL);
}
Example #23
0
xmlDeregisterNodeFunc
xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
{
    xmlDeregisterNodeFunc old;

    xmlMutexLock(xmlThrDefMutex);
    old = xmlDeregisterNodeDefaultValueThrDef;
    
    __xmlRegisterCallbacks = 1;
    xmlDeregisterNodeDefaultValueThrDef = func;
    xmlMutexUnlock(xmlThrDefMutex);

    return(old);
}
Example #24
0
xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
    xmlParserInputBufferCreateFilenameFunc old;
    
    xmlMutexLock(xmlThrDefMutex);
    old = xmlParserInputBufferCreateFilenameValueThrDef;
    if (old == NULL) {
		old = __xmlParserInputBufferCreateFilename;
	}

    xmlParserInputBufferCreateFilenameValueThrDef = func;
    xmlMutexUnlock(xmlThrDefMutex);

    return(old);
}
Example #25
0
xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
    xmlOutputBufferCreateFilenameFunc old;
    
    xmlMutexLock(xmlThrDefMutex);
    old = xmlOutputBufferCreateFilenameValueThrDef;
#ifdef LIBXML_OUTPUT_ENABLED
    if (old == NULL) {
		old = __xmlOutputBufferCreateFilename;
	}
#endif
    xmlOutputBufferCreateFilenameValueThrDef = func;
    xmlMutexUnlock(xmlThrDefMutex);

    return(old);
}
Example #26
0
void
xmlMemDisplay(FILE *fp)
{
#ifdef MEM_LIST
    MEMHDR *p;
    unsigned idx;
    int     nb = 0;
#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
    time_t currentTime;
    char buf[500];
    struct tm * tstruct;
#endif
#endif
    FILE *old_fp = fp;

    if (fp == NULL) {
        fp = fopen(".memorylist", "w");
        if (fp == NULL)
            return;
    }

#ifdef MEM_LIST
#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME)
    currentTime = time(NULL);
    tstruct = localtime(&currentTime);
    strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
    fprintf(fp,"      %s\n\n", buf);
#endif

    
    fprintf(fp,"      MEMORY ALLOCATED : %lu, MAX was %lu\n",
            debugMemSize, debugMaxMemSize);
    fprintf(fp,"BLOCK  NUMBER   SIZE  TYPE\n");
    idx = 0;
    xmlMutexLock(xmlMemMutex);
    p = memlist;
    while (p) {
          fprintf(fp,"%-5u  %6lu %6lu ",idx++,p->mh_number,
                  (unsigned long)p->mh_size);
        switch (p->mh_type) {
           case STRDUP_TYPE:fprintf(fp,"strdup()  in ");break;
           case MALLOC_TYPE:fprintf(fp,"malloc()  in ");break;
           case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
           case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc()  in ");break;
           case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
           default:
                fprintf(fp,"Unknown memory block, may be corrupted");
                xmlMutexUnlock(xmlMemMutex);
                if (old_fp == NULL)
                    fclose(fp);
                return;
        }
        if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
        if (p->mh_tag != MEMTAG)
              fprintf(fp,"  INVALID");
        nb++;
        if (nb < 100)
            xmlMemContentShow(fp, p);
        else
            fprintf(fp," skip");

        fprintf(fp,"\n");
        p = p->mh_next;
    }
    xmlMutexUnlock(xmlMemMutex);
#else
    fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
    if (old_fp == NULL)
        fclose(fp);
}
Example #27
0
/**
 * xmlMemFree:
 * @ptr:  the memory block pointer
 *
 * a free() equivalent, with error checking.
 */
void
xmlMemFree(void *ptr)
{
    MEMHDR *p;
    char *target;
#ifdef DEBUG_MEMORY
    size_t size;
#endif

    if (ptr == (void *) -1) {
        xmlGenericError(xmlGenericErrorContext,
            "trying to free pointer from freed area\n");
        goto error;
    }

    if (xmlMemTraceBlockAt == ptr) {
        xmlGenericError(xmlGenericErrorContext,
                        "%p : Freed()\n", xmlMemTraceBlockAt);
        xmlMallocBreakpoint();
    }

    TEST_POINT

    target = (char *) ptr;

    p = CLIENT_2_HDR(ptr);
    if (p->mh_tag != MEMTAG) {
        Mem_Tag_Err(p);
        goto error;
    }
    if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
    p->mh_tag = ~MEMTAG;
    memset(target, -1, p->mh_size);
    xmlMutexLock(xmlMemMutex);
    debugMemSize -= p->mh_size;
    debugMemBlocks--;
#ifdef DEBUG_MEMORY
    size = p->mh_size;
#endif
#ifdef MEM_LIST
    debugmem_list_delete(p);
#endif
    xmlMutexUnlock(xmlMemMutex);

    free(p);

    TEST_POINT

#ifdef DEBUG_MEMORY
    xmlGenericError(xmlGenericErrorContext,
            "Freed(%d) Ok\n", size);
#endif
    
    return;
    
error:    
    xmlGenericError(xmlGenericErrorContext,
            "xmlMemFree(%lX) error\n", (unsigned long) ptr);
    xmlMallocBreakpoint();
    return;
}
Example #28
0
void *
xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
{
    MEMHDR *p;
    unsigned long number;
#ifdef DEBUG_MEMORY
    size_t oldsize;
#endif

    if (ptr == NULL)
        return(xmlMallocLoc(size, file, line));

    if (!xmlMemInitialized) xmlInitMemory();
    TEST_POINT

    p = CLIENT_2_HDR(ptr);
    number = p->mh_number;
    if (xmlMemStopAtBlock == number) xmlMallocBreakpoint();
    if (p->mh_tag != MEMTAG) {
       Mem_Tag_Err(p);
         goto error;
    }
    p->mh_tag = ~MEMTAG;
    xmlMutexLock(xmlMemMutex);
    debugMemSize -= p->mh_size;
    debugMemBlocks--;
#ifdef DEBUG_MEMORY
    oldsize = p->mh_size;
#endif
#ifdef MEM_LIST
    debugmem_list_delete(p);
#endif
    xmlMutexUnlock(xmlMemMutex);
    
    p = (MEMHDR *) realloc(p,RESERVE_SIZE+size);
    if (!p) {
         goto error;
    }
    if (xmlMemTraceBlockAt == ptr) {
        xmlGenericError(xmlGenericErrorContext,
                        "%p : Realloced(%d -> %d) Ok\n",
                        xmlMemTraceBlockAt, p->mh_size, size);
        xmlMallocBreakpoint();
    }
    p->mh_tag = MEMTAG;
    p->mh_number = number;
    p->mh_type = REALLOC_TYPE;
    p->mh_size = size;
    p->mh_file = file;
    p->mh_line = line;
    xmlMutexLock(xmlMemMutex);
    debugMemSize += size;
    debugMemBlocks++;
    if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
    debugmem_list_add(p);
#endif
    xmlMutexUnlock(xmlMemMutex);

    TEST_POINT

#ifdef DEBUG_MEMORY
    xmlGenericError(xmlGenericErrorContext,
            "Realloced(%d to %d) Ok\n", oldsize, size);
#endif
    return(HDR_2_CLIENT(p));
    
error:    
    return(NULL);
}
Example #29
0
void
xmlMemDisplayLast(FILE *fp, long nbBytes)
{
#ifdef MEM_LIST
    MEMHDR *p;
    unsigned idx;
    int     nb = 0;
#endif
    FILE *old_fp = fp;

    if (nbBytes <= 0)
        return;

    if (fp == NULL) {
	fp = fopen(".memorylist", "w");
	if (fp == NULL)
	    return;
    }

#ifdef MEM_LIST
    fprintf(fp,"   Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n",
            nbBytes, debugMemSize, debugMaxMemSize);
    fprintf(fp,"BLOCK  NUMBER   SIZE  TYPE\n");
    idx = 0;
    xmlMutexLock(xmlMemMutex);
    p = memlist;
    while ((p) && (nbBytes > 0)) {
	  fprintf(fp,"%-5u  %6lu %6lu ",idx++,p->mh_number,
		  (unsigned long)p->mh_size);
        switch (p->mh_type) {
           case STRDUP_TYPE:fprintf(fp,"strdup()  in ");break;
           case MALLOC_TYPE:fprintf(fp,"malloc()  in ");break;
           case REALLOC_TYPE:fprintf(fp,"realloc() in ");break;
           case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomickdMalloc()  in ");break;
           case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomickdRealloc() in ");break;
           default:
	        fprintf(fp,"Unknown memory block, may be corrupted");
		xmlMutexUnlock(xmlMemMutex);
		if (old_fp == NULL)
		    fclose(fp);
		return;
        }
	if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
        if (p->mh_tag != MEMTAG)
	      fprintf(fp,"  INVALID");
        nb++;
	if (nb < 100)
	    xmlMemContentShow(fp, p);
	else
	    fprintf(fp," skip");

        fprintf(fp,"\n");
	nbBytes -= (unsigned long)p->mh_size;
        p = p->mh_next;
    }
    xmlMutexUnlock(xmlMemMutex);
#else
    fprintf ( fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
    if (old_fp == NULL)
	fclose ( fp );
}
Example #30
0
void
xmlInitializeGlobalState(xmlGlobalStatePtr gs)
{
#ifdef DEBUG_GLOBALS
    fprintf(stderr, "Initializing globals at %lu for thread %d\n",
	    (unsigned long) gs, xmlGetThreadId());
#endif
#if 0

    /*
     * Perform initialization as required by libxml
     */
    if (xmlThrDefMutex == NULL)
        xmlInitGlobals();

    xmlMutexLock(xmlThrDefMutex);
#ifdef LIBXML_DOCB_ENABLED
    initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
#endif
#ifdef LIBXML_HTML_ENABLED
    inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
#endif

#endif

    gs->oldXMLWDcompatibility = 0;
    gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
    gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;

#if 0
#ifdef LIBXML_SAX1_ENABLED
    initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
#endif /* LIBXML_SAX1_ENABLED */
    gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
    gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
    gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
    gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
#endif	
    gs->xmlDoValidityCheckingDefaultValue = 
         xmlDoValidityCheckingDefaultValueThrDef;
/*#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)*/
#if 0	
    gs->xmlFree = (xmlFreeFunc) xmlMemFree;
    gs->xmlMalloc = (xmlMallocFunc) xmlMemMalloc;
    gs->xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
    gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
    gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
    gs->xmlFree = (xmlFreeFunc) free;
    gs->xmlMalloc = (xmlMallocFunc) malloc;
    gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
    gs->xmlRealloc = (xmlReallocFunc) realloc;
    gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
    /*gs->xmlMemStrdup = &of_strdup;*/
#endif
    gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
    gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef;
    gs->xmlTreeIndentString = xmlTreeIndentStringThrDef;
    gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef;
    gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
    gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
    gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
    gs->xmlParserVersion = LIBXML_VERSION_STRING;
    gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
    gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
    gs->xmlSubstituteEntitiesDefaultValue = 
        xmlSubstituteEntitiesDefaultValueThrDef;

    gs->xmlGenericError = xmlGenericErrorThrDef;
    gs->xmlStructuredError = xmlStructuredErrorThrDef;
    gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
    gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
    gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;

	gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef;
	gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
    memset(&gs->xmlLastError, 0, sizeof(xmlError));

#if 0
    xmlMutexUnlock(xmlThrDefMutex);
#endif

}