moriyoshi               Sun Jun 15 16:40:45 2003 EDT

  Modified files:              
    /php4/ext/xml       compat.c expat_compat.h 
  Log:
  Removed xmlMemSetup() code as it doesn't help at all.
  
  
Index: php4/ext/xml/compat.c
diff -u php4/ext/xml/compat.c:1.12 php4/ext/xml/compat.c:1.13
--- php4/ext/xml/compat.c:1.12  Tue Jun 10 16:03:40 2003
+++ php4/ext/xml/compat.c       Sun Jun 15 16:40:45 2003
@@ -291,42 +291,18 @@
        return XML_ParserCreate_MM(encoding, NULL, tmp);
 }
 
-static void *(*_expat_cpt_malloc_fcn)(size_t sz);
-
-static char *_expat_cpt_intn_strdup(const char *str)
-{
-       size_t len;
-       char *retval;
-
-       len = strlen(str);
-       if ((retval = _expat_cpt_malloc_fcn(len + 1)) == NULL) {
-               return NULL;
-       }
-       memcpy(retval, str, len + 1);
-
-       return retval;
-}
-
 XML_Parser
 XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite 
*memsuite, const XML_Char *sep)
 {
        XML_Parser parser;
-       static XML_Memory_Handling_Suite mtemp_i = { malloc, realloc, free };
-
-       if (memsuite == NULL) {
-               memsuite = &mtemp_i;
-       }
-
-       _expat_cpt_malloc_fcn = memsuite->malloc_fcn; /* FIXME: not reentrant ! */
-
-       xmlMemSetup(memsuite->free_fcn, memsuite->malloc_fcn, memsuite->realloc_fcn, 
_expat_cpt_intn_strdup); /* WHOCANFIXME: not reentrant ! */
 
-       parser = (XML_Parser) memsuite->malloc_fcn(sizeof(struct _XML_Parser));
+       parser = (XML_Parser) emalloc(sizeof(struct _XML_Parser));
        memset(parser, 0, sizeof(struct _XML_Parser));
        parser->use_namespace = 0;
        parser->mem_hdlrs = *memsuite;
        parser->parser = xmlCreatePushParserCtxt((xmlSAXHandlerPtr) 
&php_xml_compat_handlers, (void *) parser, NULL, 0, NULL);
        if (parser->parser == NULL) {
+               efree(parser);
                return NULL;
        }
        if (encoding != NULL) {
@@ -572,7 +548,7 @@
                xmlHashFree(parser->_reverse_ns_map, _free_ns_name);
        }
        xmlFreeParserCtxt(parser->parser);
-       parser->mem_hdlrs.free_fcn(parser);
+       efree(parser);
 }
 
 #endif /* LIBXML_EXPAT_COMPAT */
Index: php4/ext/xml/expat_compat.h
diff -u php4/ext/xml/expat_compat.h:1.9 php4/ext/xml/expat_compat.h:1.10
--- php4/ext/xml/expat_compat.h:1.9     Tue Jun 10 16:03:40 2003
+++ php4/ext/xml/expat_compat.h Sun Jun 15 16:40:45 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: expat_compat.h,v 1.9 2003/06/10 20:03:40 imajes Exp $ */
+/* $Id: expat_compat.h,v 1.10 2003/06/15 20:40:45 moriyoshi Exp $ */
 
 #ifndef PHP_EXPAT_COMPAT_H
 #define PHP_EXPAT_COMPAT_H
@@ -57,8 +57,6 @@
        
        void *user;
        xmlParserCtxtPtr parser;
-
-       XML_Memory_Handling_Suite        mem_hdlrs;
 
        XML_StartElementHandler          h_start_element;
        XML_EndElementHandler            h_end_element;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to