]> granicus.if.org Git - php/commitdiff
Fixed construct bug and Windows build.
authorJohn Coggeshall <john@php.net>
Fri, 16 Apr 2004 21:51:59 +0000 (21:51 +0000)
committerJohn Coggeshall <john@php.net>
Fri, 16 Apr 2004 21:51:59 +0000 (21:51 +0000)
ext/tidy/tidy.c

index b425b51eb7ea326ad71a1d7e81910ae314da38fe..ee140f7c71015103a6e3e5b116021949d2095038 100644 (file)
@@ -330,6 +330,7 @@ void php_tidy_free(void *buf)
 
 void php_tidy_panic(ctmbstr msg)
 {
+    TSRMLS_FETCH();
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg);
 }
 
@@ -1360,17 +1361,20 @@ TIDY_DOC_METHOD(__construct)
        
        obj = (PHPTidyObj *)zend_object_store_get_object(object TSRMLS_CC);
        
-       if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) {
-               TIDY_THROW("Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : "");
-               return;
-       }
-
-       TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
+    if(inputfile) {
+        
+        if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) {
+            TIDY_THROW("Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : "");
+            return;
+        }
+        
+        TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options);
 
-       php_tidy_parse_string(obj, contents, enc TSRMLS_CC);
+       php_tidy_parse_string(obj, contents, enc TSRMLS_CC);
+       
+       efree(contents);
+    }
        
-       efree(contents);
-
 }
 
 TIDY_DOC_METHOD(parseFile)