summaryrefslogtreecommitdiff
path: root/ext/tidy/tidy.c
diff options
context:
space:
mode:
authorJohn Coggeshall <john@php.net>2004-01-14 08:15:57 +0000
committerJohn Coggeshall <john@php.net>2004-01-14 08:15:57 +0000
commitf3932751d8aeb60b84920948d7d66818b1bfcedd (patch)
treeee7fab1d49fd83ee4d838d9fa996e05fbaff26ce /ext/tidy/tidy.c
parent0878fa901fe1a5891adb29b4b457bb223eb97dca (diff)
downloadphp-git-f3932751d8aeb60b84920948d7d66818b1bfcedd.tar.gz
Apparently MSVC is not C99 compatible making variable marco arguments
in the TIDY_THROW() marco broken in (at least) Win32. This provides a suitable workaround for non-C99 compatible compilers.
Diffstat (limited to 'ext/tidy/tidy.c')
-rw-r--r--ext/tidy/tidy.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 9315d2d9a0..61ba2312dd 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -157,6 +157,22 @@ void php_tidy_panic(ctmbstr msg)
zend_error(E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg);
}
+/* Workaround for compilers that are not C99 complaint */
+static void _php_tidy_throw_exception(char *message, ...)
+{
+ char *msg;
+ va_list ap;
+
+ TSRMLS_FETCH();
+
+ va_start(ap, message);
+ vspprintf(&msg, 0, message, ap);
+ zend_throw_exception(tidy_ce_exception, msg, 0 TSRMLS_CC);
+ va_end(ap);
+ efree(msg);
+
+}
+
static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS_DC)
{
TidyOption opt;
@@ -700,6 +716,10 @@ static void tidy_globals_ctor(void *global TSRMLS_DC)
{
}
+static void tidy_globals_dtor(void *global TSRMLS_DC)
+{
+}
+
PHP_MINIT_FUNCTION(tidy)
{
ZEND_INIT_MODULE_GLOBALS(tidy, tidy_globals_ctor, tidy_globals_dtor);