cvs: pecl /tidy tidy.c
| From: | Ilia Alshanetsky | Date: | Mon, 15 Dec 2003 21:56:55 +0000 |
| Subject: | cvs: pecl /tidy tidy.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-586@lists.php.net to get a copy of this message | ||
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();