Re: cvs: pecl /tidy tidy.c

From: Date: Wed, 17 Dec 2003 10:00:02 +0000
Subject: Re: cvs: pecl /tidy tidy.c
References: 1  Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-587@lists.php.net to get a copy of this message
I don't understand this. You should always be using emalloc/efree even without memory limit because it's PHP's safety net for per-request leaks. It would be really bad if you're using malloc/free. Andi At 09:56 PM 12/15/2003 +0000, Ilia Alshanetsky wrote:
iliaa           Mon Dec 15 16:56:55 2003 EDT
Modified files:
    /pecl/tidy  tidy.c
Log: Always set panic call handler, allows us to address critical libtidy errors from inside PHP. When memory_limit is enabled use e* memory allocation macros to control memory usage. Index: pecl/tidy/tidy.c diff -u pecl/tidy/tidy.c:1.21 pecl/tidy/tidy.c:1.22
--- pecl/tidy/tidy.c:1.21       Sun Dec 14 20:43:45 2003
+++ pecl/tidy/tidy.c    Mon Dec 15 16:56:55 2003
@@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tidy.c,v 1.21 2003/12/15 01:43:45 john Exp $ */ +/* $Id: tidy.c,v 1.22 2003/12/15 21:56:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -156,6 +156,7 @@ ZEND_GET_MODULE(tidy) #endif +#if MEMORY_LIMIT void *php_tidy_malloc(size_t len) {
        return emalloc(len);
@@ -170,13 +171,12 @@ {
        efree(buf);
} - +#endif void php_tidy_panic(ctmbstr msg) {
        zend_error(E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg);
} - static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_file) {
        char *data=NULL, *cfg_file=NULL, *arg1;
@@ -297,13 +297,13 @@
                        break;
                case is_doc:
-/* for debugging of libtidy only +#if MEMORY_LIMIT
                        tidySetMallocCall(php_tidy_malloc);
                        tidySetReallocCall(php_tidy_realloc);
                        tidySetFreeCall(php_tidy_free);
- +#endif
                        tidySetPanicCall(php_tidy_panic);
-*/ +
                        intern->ptdoc = emalloc(sizeof(PHPTidyDoc));
                        intern->ptdoc->doc = tidyCreate();
                        intern->ptdoc->parsed = FALSE;
@@ -742,7 +742,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Tidy support", "enabled");
        php_info_print_table_row(2, "libTidy Library Version", (char *)tidyReleaseDate());
-       php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.21 2003/12/15 01:43:45 john Exp $)");
+       php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.22 2003/12/15 21:56:55 iliaa Exp $)");
        php_info_print_table_end();
        DISPLAY_INI_ENTRIES();
-- PECL CVS Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pecl.cvs (#587) next »