more static keywording

also remove the libtidy patch, as it is too old. users should use a newer libtify anyway
This commit is contained in:
Nuno Lopes 2006-08-14 15:09:08 +00:00
parent 4b7358e4e5
commit 0091c7e1b3
4 changed files with 90 additions and 111 deletions

View file

@ -5,12 +5,3 @@ README FOR ext/tidy by John Coggeshall <john@php.net>
Tidy is an extension based on Libtidy (http://tidy.sf.net/) and allows a PHP developer
to clean, repair, and traverse HTML, XHTML, and XML documents -- including ones with
embedded scripting languages such as PHP or ASP within them using OO constructs.
---------------------------------------------------------------------------------------
!! Important Note !!
---------------------------------------------------------------------------------------
Older versions of libtidy have a small memory leak inside the ParseConfigFileEnc() function
used to load configuration from a file. If you intend to use this functionality apply
the "libtidy.txt" patch (cd tidy/src/; patch -p0 < libtidy.txt) to libtidy sources and
then recompile libtidy.
---------------------------------------------------------------------------------------

View file

@ -1,12 +0,0 @@
--- config.c Mon Jun 9 04:07:55 2003
+++ config.c Sun Sep 21 16:13:04 2003
@@ -719,7 +719,8 @@
}
fclose( fin );
- MemFree( cfg->cfgIn );
+ MemFree( cfg->cfgIn->source.sourceData );
+ MemFree( cfg->cfgIn );
cfg->cfgIn = NULL;
}

View file

@ -39,57 +39,57 @@ extern zend_module_entry tidy_module_entry;
#define TIDY_ATTR_METHOD(name) PHP_FUNCTION(tam_ ##name)
#define TIDY_ATTR_ME(name, param) TIDY_METHOD_MAP(name, tam_ ##name, param)
PHP_MINIT_FUNCTION(tidy);
PHP_MSHUTDOWN_FUNCTION(tidy);
PHP_RINIT_FUNCTION(tidy);
PHP_MINFO_FUNCTION(tidy);
static PHP_MINIT_FUNCTION(tidy);
static PHP_MSHUTDOWN_FUNCTION(tidy);
static PHP_RINIT_FUNCTION(tidy);
static PHP_MINFO_FUNCTION(tidy);
PHP_FUNCTION(tidy_getopt);
PHP_FUNCTION(tidy_parse_string);
PHP_FUNCTION(tidy_parse_file);
PHP_FUNCTION(tidy_clean_repair);
PHP_FUNCTION(tidy_repair_string);
PHP_FUNCTION(tidy_repair_file);
PHP_FUNCTION(tidy_diagnose);
PHP_FUNCTION(tidy_get_output);
PHP_FUNCTION(tidy_get_error_buffer);
PHP_FUNCTION(tidy_get_release);
PHP_FUNCTION(tidy_reset_config);
PHP_FUNCTION(tidy_get_config);
PHP_FUNCTION(tidy_get_status);
PHP_FUNCTION(tidy_get_html_ver);
static PHP_FUNCTION(tidy_getopt);
static PHP_FUNCTION(tidy_parse_string);
static PHP_FUNCTION(tidy_parse_file);
static PHP_FUNCTION(tidy_clean_repair);
static PHP_FUNCTION(tidy_repair_string);
static PHP_FUNCTION(tidy_repair_file);
static PHP_FUNCTION(tidy_diagnose);
static PHP_FUNCTION(tidy_get_output);
static PHP_FUNCTION(tidy_get_error_buffer);
static PHP_FUNCTION(tidy_get_release);
static PHP_FUNCTION(tidy_reset_config);
static PHP_FUNCTION(tidy_get_config);
static PHP_FUNCTION(tidy_get_status);
static PHP_FUNCTION(tidy_get_html_ver);
#if HAVE_TIDYOPTGETDOC
PHP_FUNCTION(tidy_get_opt_doc);
static PHP_FUNCTION(tidy_get_opt_doc);
#endif
PHP_FUNCTION(tidy_is_xhtml);
PHP_FUNCTION(tidy_is_xml);
PHP_FUNCTION(tidy_error_count);
PHP_FUNCTION(tidy_warning_count);
PHP_FUNCTION(tidy_access_count);
PHP_FUNCTION(tidy_config_count);
static PHP_FUNCTION(tidy_is_xhtml);
static PHP_FUNCTION(tidy_is_xml);
static PHP_FUNCTION(tidy_error_count);
static PHP_FUNCTION(tidy_warning_count);
static PHP_FUNCTION(tidy_access_count);
static PHP_FUNCTION(tidy_config_count);
PHP_FUNCTION(ob_tidyhandler);
static PHP_FUNCTION(ob_tidyhandler);
PHP_FUNCTION(tidy_get_root);
PHP_FUNCTION(tidy_get_html);
PHP_FUNCTION(tidy_get_head);
PHP_FUNCTION(tidy_get_body);
static PHP_FUNCTION(tidy_get_root);
static PHP_FUNCTION(tidy_get_html);
static PHP_FUNCTION(tidy_get_head);
static PHP_FUNCTION(tidy_get_body);
TIDY_DOC_METHOD(__construct);
TIDY_DOC_METHOD(parseFile);
TIDY_DOC_METHOD(parseString);
static TIDY_DOC_METHOD(__construct);
static TIDY_DOC_METHOD(parseFile);
static TIDY_DOC_METHOD(parseString);
TIDY_NODE_METHOD(__construct);
TIDY_NODE_METHOD(hasChildren);
TIDY_NODE_METHOD(hasSiblings);
TIDY_NODE_METHOD(isComment);
TIDY_NODE_METHOD(isHtml);
TIDY_NODE_METHOD(isXhtml);
TIDY_NODE_METHOD(isXml);
TIDY_NODE_METHOD(isText);
TIDY_NODE_METHOD(isJste);
TIDY_NODE_METHOD(isAsp);
TIDY_NODE_METHOD(isPhp);
static TIDY_NODE_METHOD(__construct);
static TIDY_NODE_METHOD(hasChildren);
static TIDY_NODE_METHOD(hasSiblings);
static TIDY_NODE_METHOD(isComment);
static TIDY_NODE_METHOD(isHtml);
static TIDY_NODE_METHOD(isXhtml);
static TIDY_NODE_METHOD(isXml);
static TIDY_NODE_METHOD(isText);
static TIDY_NODE_METHOD(isJste);
static TIDY_NODE_METHOD(isAsp);
static TIDY_NODE_METHOD(isPhp);
ZEND_BEGIN_MODULE_GLOBALS(tidy)
char *default_config;

View file

@ -246,7 +246,7 @@ STD_PHP_INI_ENTRY("tidy.default_config", "", PHP_INI_SYSTEM, OnUpdateString, d
PHP_INI_ENTRY("tidy.clean_output", "0", PHP_INI_PERDIR, NULL)
PHP_INI_END()
zend_function_entry tidy_functions[] = {
static zend_function_entry tidy_functions[] = {
PHP_FE(tidy_getopt, NULL)
PHP_FE(tidy_parse_string, NULL)
PHP_FE(tidy_parse_file, NULL)
@ -277,7 +277,7 @@ zend_function_entry tidy_functions[] = {
{NULL, NULL, NULL}
};
zend_function_entry tidy_funcs_doc[] = {
static zend_function_entry tidy_funcs_doc[] = {
TIDY_METHOD_MAP(getOpt, tidy_getopt, NULL)
TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, NULL)
TIDY_DOC_ME(parseFile, NULL)
@ -302,7 +302,7 @@ zend_function_entry tidy_funcs_doc[] = {
{NULL, NULL, NULL}
};
zend_function_entry tidy_funcs_node[] = {
static zend_function_entry tidy_funcs_node[] = {
TIDY_NODE_ME(__construct, NULL)
TIDY_NODE_ME(hasChildren, NULL)
TIDY_NODE_ME(hasSiblings, NULL)
@ -950,7 +950,7 @@ static int php_tidy_parse_string(PHPTidyObj *obj, char *string, int len, char *e
return SUCCESS;
}
PHP_MINIT_FUNCTION(tidy)
static PHP_MINIT_FUNCTION(tidy)
{
REGISTER_INI_ENTRIES();
REGISTER_TIDY_CLASS(tidy, doc, NULL, 0);
@ -970,7 +970,7 @@ PHP_MINIT_FUNCTION(tidy)
return SUCCESS;
}
PHP_RINIT_FUNCTION(tidy)
static PHP_RINIT_FUNCTION(tidy)
{
if (INI_BOOL("tidy.clean_output") == TRUE) {
if (php_start_ob_buffer_named("ob_tidyhandler", 0, 1 TSRMLS_CC) == FAILURE) {
@ -981,13 +981,13 @@ PHP_RINIT_FUNCTION(tidy)
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(tidy)
static PHP_MSHUTDOWN_FUNCTION(tidy)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
PHP_MINFO_FUNCTION(tidy)
static PHP_MINFO_FUNCTION(tidy)
{
php_info_print_table_start();
php_info_print_table_header(2, "Tidy support", "enabled");
@ -998,7 +998,7 @@ PHP_MINFO_FUNCTION(tidy)
DISPLAY_INI_ENTRIES();
}
PHP_FUNCTION(ob_tidyhandler)
static PHP_FUNCTION(ob_tidyhandler)
{
char *input;
int input_len;
@ -1055,7 +1055,7 @@ PHP_FUNCTION(ob_tidyhandler)
/* {{{ proto bool tidy_parse_string(string input [, mixed config_options [, string encoding]])
Parse a document stored in a string */
PHP_FUNCTION(tidy_parse_string)
static PHP_FUNCTION(tidy_parse_string)
{
char *input, *enc = NULL;
int input_len, enc_len = 0;
@ -1085,7 +1085,7 @@ PHP_FUNCTION(tidy_parse_string)
/* {{{ proto string tidy_get_error_buffer([boolean detailed])
Return warnings and errors which occured parsing the specified document*/
PHP_FUNCTION(tidy_get_error_buffer)
static PHP_FUNCTION(tidy_get_error_buffer)
{
TIDY_FETCH_OBJECT;
@ -1099,7 +1099,7 @@ PHP_FUNCTION(tidy_get_error_buffer)
/* {{{ proto string tidy_get_output()
Return a string representing the parsed tidy markup */
PHP_FUNCTION(tidy_get_output)
static PHP_FUNCTION(tidy_get_output)
{
TidyBuffer output = {0};
TIDY_FETCH_OBJECT;
@ -1114,7 +1114,7 @@ PHP_FUNCTION(tidy_get_output)
/* {{{ proto boolean tidy_parse_file(string file [, mixed config_options [, string encoding [, bool use_include_path]]])
Parse markup in file or URI */
PHP_FUNCTION(tidy_parse_file)
static PHP_FUNCTION(tidy_parse_file)
{
char *inputfile, *enc = NULL;
int input_len, contents_len, enc_len = 0;
@ -1152,7 +1152,7 @@ PHP_FUNCTION(tidy_parse_file)
/* {{{ proto boolean tidy_clean_repair()
Execute configured cleanup and repair operations on parsed markup */
PHP_FUNCTION(tidy_clean_repair)
static PHP_FUNCTION(tidy_clean_repair)
{
TIDY_FETCH_OBJECT;
@ -1167,7 +1167,7 @@ PHP_FUNCTION(tidy_clean_repair)
/* {{{ proto boolean tidy_repair_string(string data [, mixed config_file [, string encoding]])
Repair a string using an optionally provided configuration file */
PHP_FUNCTION(tidy_repair_string)
static PHP_FUNCTION(tidy_repair_string)
{
TIDY_SET_CONTEXT;
php_tidy_quick_repair(INTERNAL_FUNCTION_PARAM_PASSTHRU, FALSE);
@ -1176,7 +1176,7 @@ PHP_FUNCTION(tidy_repair_string)
/* {{{ proto boolean tidy_repair_file(string filename [, mixed config_file [, string encoding [, bool use_include_path]]])
Repair a file using an optionally provided configuration file */
PHP_FUNCTION(tidy_repair_file)
static PHP_FUNCTION(tidy_repair_file)
{
TIDY_SET_CONTEXT;
php_tidy_quick_repair(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE);
@ -1185,7 +1185,7 @@ PHP_FUNCTION(tidy_repair_file)
/* {{{ proto boolean tidy_diagnose()
Run configured diagnostics on parsed and repaired markup. */
PHP_FUNCTION(tidy_diagnose)
static PHP_FUNCTION(tidy_diagnose)
{
TIDY_FETCH_OBJECT;
@ -1200,7 +1200,7 @@ PHP_FUNCTION(tidy_diagnose)
/* {{{ proto string tidy_get_release()
Get release date (version) for Tidy library */
PHP_FUNCTION(tidy_get_release)
static PHP_FUNCTION(tidy_get_release)
{
TIDY_SET_CONTEXT;
@ -1216,7 +1216,7 @@ PHP_FUNCTION(tidy_get_release)
#if HAVE_TIDYOPTGETDOC
/* {{{ proto string tidy_get_opt_doc(tidy resource, string optname)
Returns the documentation for the given option name */
PHP_FUNCTION(tidy_get_opt_doc)
static PHP_FUNCTION(tidy_get_opt_doc)
{
PHPTidyObj *obj;
char *optname, *optval;
@ -1256,7 +1256,7 @@ PHP_FUNCTION(tidy_get_opt_doc)
/* {{{ proto array tidy_get_config()
Get current Tidy configuarion */
PHP_FUNCTION(tidy_get_config)
static PHP_FUNCTION(tidy_get_config)
{
TidyIterator itOpt;
char *opt_name;
@ -1295,7 +1295,7 @@ PHP_FUNCTION(tidy_get_config)
/* {{{ proto int tidy_get_status()
Get status of specfied document. */
PHP_FUNCTION(tidy_get_status)
static PHP_FUNCTION(tidy_get_status)
{
TIDY_FETCH_OBJECT;
@ -1305,7 +1305,7 @@ PHP_FUNCTION(tidy_get_status)
/* {{{ proto int tidy_get_html_ver()
Get the Detected HTML version for the specified document. */
PHP_FUNCTION(tidy_get_html_ver)
static PHP_FUNCTION(tidy_get_html_ver)
{
TIDY_FETCH_OBJECT;
@ -1315,7 +1315,7 @@ PHP_FUNCTION(tidy_get_html_ver)
/* {{{ proto boolean tidy_is_xhtml()
Indicates if the document is a XHTML document. */
PHP_FUNCTION(tidy_is_xhtml)
static PHP_FUNCTION(tidy_is_xhtml)
{
TIDY_FETCH_OBJECT;
@ -1325,7 +1325,7 @@ PHP_FUNCTION(tidy_is_xhtml)
/* {{{ proto boolean tidy_is_xhtml()
Indicates if the document is a generic (non HTML/XHTML) XML document. */
PHP_FUNCTION(tidy_is_xml)
static PHP_FUNCTION(tidy_is_xml)
{
TIDY_FETCH_OBJECT;
@ -1335,7 +1335,7 @@ PHP_FUNCTION(tidy_is_xml)
/* {{{ proto int tidy_error_count()
Returns the Number of Tidy errors encountered for specified document. */
PHP_FUNCTION(tidy_error_count)
static PHP_FUNCTION(tidy_error_count)
{
TIDY_FETCH_OBJECT;
@ -1345,7 +1345,7 @@ PHP_FUNCTION(tidy_error_count)
/* {{{ proto int tidy_warning_count()
Returns the Number of Tidy warnings encountered for specified document. */
PHP_FUNCTION(tidy_warning_count)
static PHP_FUNCTION(tidy_warning_count)
{
TIDY_FETCH_OBJECT;
@ -1355,7 +1355,7 @@ PHP_FUNCTION(tidy_warning_count)
/* {{{ proto int tidy_access_count()
Returns the Number of Tidy accessibility warnings encountered for specified document. */
PHP_FUNCTION(tidy_access_count)
static PHP_FUNCTION(tidy_access_count)
{
TIDY_FETCH_OBJECT;
@ -1365,7 +1365,7 @@ PHP_FUNCTION(tidy_access_count)
/* {{{ proto int tidy_config_count()
Returns the Number of Tidy configuration errors encountered for specified document. */
PHP_FUNCTION(tidy_config_count)
static PHP_FUNCTION(tidy_config_count)
{
TIDY_FETCH_OBJECT;
@ -1375,7 +1375,7 @@ PHP_FUNCTION(tidy_config_count)
/* {{{ proto mixed tidy_getopt(string option)
Returns the value of the specified configuration option for the tidy document. */
PHP_FUNCTION(tidy_getopt)
static PHP_FUNCTION(tidy_getopt)
{
PHPTidyObj *obj;
char *optname;
@ -1432,7 +1432,7 @@ PHP_FUNCTION(tidy_getopt)
}
/* }}} */
TIDY_DOC_METHOD(__construct)
static TIDY_DOC_METHOD(__construct)
{
char *inputfile = NULL, *enc = NULL;
int input_len = 0, enc_len = 0, contents_len = 0;
@ -1464,7 +1464,7 @@ TIDY_DOC_METHOD(__construct)
}
}
TIDY_DOC_METHOD(parseFile)
static TIDY_DOC_METHOD(parseFile)
{
char *inputfile, *enc = NULL;
int input_len, enc_len = 0, contents_len = 0;
@ -1498,7 +1498,7 @@ TIDY_DOC_METHOD(parseFile)
efree(contents);
}
TIDY_DOC_METHOD(parseString)
static TIDY_DOC_METHOD(parseString)
{
char *input, *enc = NULL;
int input_len, enc_len = 0;
@ -1525,7 +1525,7 @@ TIDY_DOC_METHOD(parseString)
/* {{{ proto TidyNode tidy_get_root()
Returns a TidyNode Object representing the root of the tidy parse tree */
PHP_FUNCTION(tidy_get_root)
static PHP_FUNCTION(tidy_get_root)
{
TIDY_SET_CONTEXT;
php_tidy_create_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, is_root_node);
@ -1534,7 +1534,7 @@ PHP_FUNCTION(tidy_get_root)
/* {{{ proto TidyNode tidy_get_html()
Returns a TidyNode Object starting from the <HTML> tag of the tidy parse tree */
PHP_FUNCTION(tidy_get_html)
static PHP_FUNCTION(tidy_get_html)
{
TIDY_SET_CONTEXT;
php_tidy_create_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, is_html_node);
@ -1543,7 +1543,7 @@ PHP_FUNCTION(tidy_get_html)
/* {{{ proto TidyNode tidy_get_head()
Returns a TidyNode Object starting from the <HEAD> tag of the tidy parse tree */
PHP_FUNCTION(tidy_get_head)
static PHP_FUNCTION(tidy_get_head)
{
TIDY_SET_CONTEXT;
php_tidy_create_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, is_head_node);
@ -1552,7 +1552,7 @@ PHP_FUNCTION(tidy_get_head)
/* {{{ proto TidyNode tidy_get_body(resource tidy)
Returns a TidyNode Object starting from the <BODY> tag of the tidy parse tree */
PHP_FUNCTION(tidy_get_body)
static PHP_FUNCTION(tidy_get_body)
{
TIDY_SET_CONTEXT;
php_tidy_create_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, is_body_node);
@ -1561,14 +1561,14 @@ PHP_FUNCTION(tidy_get_body)
/* {{{ proto tidyNode::tidyNode()
Constructor. */
TIDY_NODE_METHOD(__construct)
static TIDY_NODE_METHOD(__construct)
{
}
/* }}} */
/* {{{ proto boolean tidyNode::hasChildren()
Returns true if this node has children */
TIDY_NODE_METHOD(hasChildren)
static TIDY_NODE_METHOD(hasChildren)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1582,7 +1582,7 @@ TIDY_NODE_METHOD(hasChildren)
/* {{{ proto boolean tidyNode::hasSiblings()
Returns true if this node has siblings */
TIDY_NODE_METHOD(hasSiblings)
static TIDY_NODE_METHOD(hasSiblings)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1596,7 +1596,7 @@ TIDY_NODE_METHOD(hasSiblings)
/* {{{ proto boolean tidyNode::isComment()
Returns true if this node represents a comment */
TIDY_NODE_METHOD(isComment)
static TIDY_NODE_METHOD(isComment)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1610,7 +1610,7 @@ TIDY_NODE_METHOD(isComment)
/* {{{ proto boolean tidyNode::isHtml()
Returns true if this node is part of a HTML document */
TIDY_NODE_METHOD(isHtml)
static TIDY_NODE_METHOD(isHtml)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1624,7 +1624,7 @@ TIDY_NODE_METHOD(isHtml)
/* {{{ proto boolean tidyNode::isXhtml()
Returns true if this node is part of a XHTML document */
TIDY_NODE_METHOD(isXhtml)
static TIDY_NODE_METHOD(isXhtml)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1638,7 +1638,7 @@ TIDY_NODE_METHOD(isXhtml)
/* {{{ proto boolean tidyNode::isXml()
Returns true if this node is part of a XML document */
TIDY_NODE_METHOD(isXml)
static TIDY_NODE_METHOD(isXml)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1652,7 +1652,7 @@ TIDY_NODE_METHOD(isXml)
/* {{{ proto boolean tidyNode::isText()
Returns true if this node represents text (no markup) */
TIDY_NODE_METHOD(isText)
static TIDY_NODE_METHOD(isText)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1666,7 +1666,7 @@ TIDY_NODE_METHOD(isText)
/* {{{ proto boolean tidyNode::isJste()
Returns true if this node is JSTE */
TIDY_NODE_METHOD(isJste)
static TIDY_NODE_METHOD(isJste)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1680,7 +1680,7 @@ TIDY_NODE_METHOD(isJste)
/* {{{ proto boolean tidyNode::isAsp()
Returns true if this node is ASP */
TIDY_NODE_METHOD(isAsp)
static TIDY_NODE_METHOD(isAsp)
{
TIDY_FETCH_ONLY_OBJECT;
@ -1694,7 +1694,7 @@ TIDY_NODE_METHOD(isAsp)
/* {{{ proto boolean tidyNode::isPhp()
Returns true if this node is PHP */
TIDY_NODE_METHOD(isPhp)
static TIDY_NODE_METHOD(isPhp)
{
TIDY_FETCH_ONLY_OBJECT;