From b6a3f48d86fe5b801df261d4c123a149844e4f9d Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 15 Dec 2003 21:56:55 +0000 Subject: [PATCH] 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. --- ext/tidy/tidy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 1b77e1a712..c7c43bbe11 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -156,6 +156,7 @@ zend_module_entry tidy_module_entry = { ZEND_GET_MODULE(tidy) #endif +#if MEMORY_LIMIT void *php_tidy_malloc(size_t len) { return emalloc(len); @@ -170,13 +171,12 @@ void php_tidy_free(void *buf) { 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 @@ static void tidy_object_new(zend_class_entry *class_type, zend_object_handlers * 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; -- 2.50.1