john            Wed Jan 14 03:16:00 2004 EDT

  Modified files:              
    /php-src/ext/tidy   php_tidy.h tidy.c 
  Log:
  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.
  
  
Index: php-src/ext/tidy/php_tidy.h
diff -u php-src/ext/tidy/php_tidy.h:1.17 php-src/ext/tidy/php_tidy.h:1.18
--- php-src/ext/tidy/php_tidy.h:1.17    Tue Jan 13 21:43:32 2004
+++ php-src/ext/tidy/php_tidy.h Wed Jan 14 03:15:57 2004
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_tidy.h,v 1.17 2004/01/14 02:43:32 john Exp $ */
+/* $Id: php_tidy.h,v 1.18 2004/01/14 08:15:57 john Exp $ */
 
 #ifndef PHP_TIDY_H
 #define PHP_TIDY_H
@@ -92,7 +92,14 @@
     }
 
 
+/* This is necessary, as apparently some Win32 compilers aren't C99
+   compliant. When that isn't the case we can't use variable arg preprocessor
+   macros and need to instead call a wrapper function */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__  >= 199901L
 #define TIDY_THROW(...) zend_throw_exception_ex(tidy_ce_exception, 0 TSRMLS_CC, 
__VA_ARGS__)
+#else
+#define TIDY_THROW _php_tidy_throw_exception
+#endif
 
 #define TIDY_NODE_METHOD(name)    PHP_FUNCTION(tnm_ ##name)
 #define TIDY_NODE_ME(name, param)      TIDY_METHOD_MAP(name, tnm_ ##name, param)
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.33 php-src/ext/tidy/tidy.c:1.34
--- php-src/ext/tidy/tidy.c:1.33        Tue Jan 13 21:43:32 2004
+++ php-src/ext/tidy/tidy.c     Wed Jan 14 03:15:57 2004
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: tidy.c,v 1.33 2004/01/14 02:43:32 john Exp $ */
+/* $Id: tidy.c,v 1.34 2004/01/14 08:15:57 john Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -157,6 +157,22 @@
        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_dtor(void *global TSRMLS_DC)
+{
+}
+
 PHP_MINIT_FUNCTION(tidy)
 {
        ZEND_INIT_MODULE_GLOBALS(tidy, tidy_globals_ctor, tidy_globals_dtor);
@@ -748,7 +768,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Tidy support", "enabled");
        php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate());
-       php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " 
($Id: tidy.c,v 1.33 2004/01/14 02:43:32 john Exp $)");
+       php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " 
($Id: tidy.c,v 1.34 2004/01/14 08:15:57 john Exp $)");
        php_info_print_table_end();
 
        DISPLAY_INI_ENTRIES();

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

Reply via email to