summaryrefslogtreecommitdiff
path: root/ext/xml/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/xml/xml.c')
-rw-r--r--ext/xml/xml.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 494c347201..b1f8cc5bd9 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -290,7 +290,7 @@ xml_encoding xml_encodings[] = {
static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
/* True globals, no need for thread safety */
-static int le_xml_parser;
+static int le_xml_parser;
/* }}} */
@@ -353,7 +353,7 @@ PHP_MINIT_FUNCTION(xml)
REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT);
/* this object should not be pre-initialised at compile time,
- as the order of members may vary */
+ as the order of members may vary */
php_xml_mem_hdlrs.malloc_fcn = php_xml_malloc_wrapper;
php_xml_mem_hdlrs.realloc_fcn = php_xml_realloc_wrapper;
@@ -401,7 +401,7 @@ static void _xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encodi
static void xml_parser_dtor(zend_resource *rsrc)
{
xml_parser *parser = (xml_parser *)rsrc->ptr;
-
+
if (parser->parser) {
XML_ParserFree(parser->parser);
}
@@ -479,7 +479,7 @@ static void xml_set_handler(zval *handler, zval *data)
/* {{{ xml_call_handler() */
static void xml_call_handler(xml_parser *parser, zval *handler, zend_function *function_ptr, int argc, zval *argv, zval *retval)
{
- int i;
+ int i;
ZVAL_UNDEF(retval);
if (parser && handler && !EG(exception)) {
@@ -508,10 +508,10 @@ static void xml_call_handler(xml_parser *parser, zval *handler, zend_function *f
Z_TYPE_P(obj) == IS_OBJECT &&
Z_TYPE_P(method) == IS_STRING) {
php_error_docref(NULL, E_WARNING, "Unable to call handler %s::%s()", ZSTR_VAL(Z_OBJCE_P(obj)->name), Z_STRVAL_P(method));
- } else
+ } else
php_error_docref(NULL, E_WARNING, "Unable to call handler");
}
- }
+ }
for (i = 0; i < argc; i++) {
zval_ptr_dtor(&argv[i]);
}
@@ -693,10 +693,10 @@ static void _xml_add_to_info(xml_parser *parser,char *name)
zval values;
array_init(&values);
element = zend_hash_str_update(Z_ARRVAL(parser->info), name, strlen(name), &values);
- }
-
+ }
+
add_next_index_long(element, parser->curtag);
-
+
parser->curtag++;
}
/* }}} */
@@ -747,10 +747,10 @@ void _xml_startElementHandler(void *userData, const XML_Char *name, const XML_Ch
zend_string_release(att);
}
-
+
xml_call_handler(parser, &parser->startElementHandler, parser->startElementPtr, 3, args, &retval);
zval_ptr_dtor(&retval);
- }
+ }
if (!Z_ISUNDEF(parser->data)) {
if (parser->level <= XML_MAXLEVEL) {
@@ -820,7 +820,7 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
xml_call_handler(parser, &parser->endElementHandler, parser->endElementPtr, 2, args, &retval);
zval_ptr_dtor(&retval);
- }
+ }
if (!Z_ISUNDEF(parser->data)) {
zval tag;
@@ -829,13 +829,13 @@ void _xml_endElementHandler(void *userData, const XML_Char *name)
add_assoc_string(parser->ctag, "type", "complete");
} else {
array_init(&tag);
-
+
_xml_add_to_info(parser, ZSTR_VAL(tag_name) + parser->toffset);
add_assoc_string(&tag, "tag", SKIP_TAGSTART(ZSTR_VAL(tag_name))); /* cast to avoid gcc-warning */
add_assoc_string(&tag, "type", "close");
add_assoc_long(&tag, "level", parser->level);
-
+
zend_hash_next_index_insert(Z_ARRVAL(parser->data), &tag);
}
@@ -866,7 +866,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
_xml_xmlchar_zval(s, len, parser->target_encoding, &args[1]);
xml_call_handler(parser, &parser->characterDataHandler, parser->characterDataPtr, 2, args, &retval);
zval_ptr_dtor(&retval);
- }
+ }
if (!Z_ISUNDEF(parser->data)) {
size_t i;
@@ -891,7 +891,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
if (doprint || (! parser->skipwhite)) {
if (parser->lastwasopen) {
zval *myval;
-
+
/* check if the current tag already has a value - if yes append to that! */
if ((myval = zend_hash_str_find(Z_ARRVAL_P(parser->ctag), "value", sizeof("value") - 1))) {
int newlen = Z_STRLEN_P(myval) + ZSTR_LEN(decoded_value);
@@ -902,7 +902,7 @@ void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
} else {
add_assoc_str(parser->ctag, "value", decoded_value);
}
-
+
} else {
zval tag;
zval *curtag, *mytype, *myval;
@@ -980,8 +980,8 @@ void _xml_defaultHandler(void *userData, const XML_Char *s, int len)
/* }}} */
/* {{{ _xml_unparsedEntityDeclHandler() */
-void _xml_unparsedEntityDeclHandler(void *userData,
- const XML_Char *entityName,
+void _xml_unparsedEntityDeclHandler(void *userData,
+ const XML_Char *entityName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
@@ -1102,9 +1102,9 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
char *ns_param = NULL;
size_t ns_param_len = 0;
-
+
XML_Char *encoding;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|ss": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
RETURN_FALSE;
}
@@ -1149,15 +1149,15 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
}
/* }}} */
-/* {{{ proto resource xml_parser_create([string encoding])
+/* {{{ proto resource xml_parser_create([string encoding])
Create an XML parser */
PHP_FUNCTION(xml_parser_create)
{
- php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+ php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
-/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]])
+/* {{{ proto resource xml_parser_create_ns([string encoding [, string sep]])
Create an XML parser */
PHP_FUNCTION(xml_parser_create_ns)
{
@@ -1165,7 +1165,7 @@ PHP_FUNCTION(xml_parser_create_ns)
}
/* }}} */
-/* {{{ proto int xml_set_object(resource parser, object &obj)
+/* {{{ proto int xml_set_object(resource parser, object &obj)
Set up object which should be used for callbacks */
PHP_FUNCTION(xml_set_object)
{
@@ -1194,7 +1194,7 @@ PHP_FUNCTION(xml_set_object)
}
/* }}} */
-/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl)
+/* {{{ proto int xml_set_element_handler(resource parser, string shdl, string ehdl)
Set up start and end element handlers */
PHP_FUNCTION(xml_set_element_handler)
{
@@ -1216,7 +1216,7 @@ PHP_FUNCTION(xml_set_element_handler)
}
/* }}} */
-/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_character_data_handler(resource parser, string hdl)
Set up character data handler */
PHP_FUNCTION(xml_set_character_data_handler)
{
@@ -1237,7 +1237,7 @@ PHP_FUNCTION(xml_set_character_data_handler)
}
/* }}} */
-/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_processing_instruction_handler(resource parser, string hdl)
Set up processing instruction (PI) handler */
PHP_FUNCTION(xml_set_processing_instruction_handler)
{
@@ -1258,7 +1258,7 @@ PHP_FUNCTION(xml_set_processing_instruction_handler)
}
/* }}} */
-/* {{{ proto int xml_set_default_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_default_handler(resource parser, string hdl)
Set up default handler */
PHP_FUNCTION(xml_set_default_handler)
{
@@ -1279,7 +1279,7 @@ PHP_FUNCTION(xml_set_default_handler)
}
/* }}} */
-/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl)
Set up unparsed entity declaration handler */
PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
{
@@ -1300,7 +1300,7 @@ PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
}
/* }}} */
-/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_notation_decl_handler(resource parser, string hdl)
Set up notation declaration handler */
PHP_FUNCTION(xml_set_notation_decl_handler)
{
@@ -1321,7 +1321,7 @@ PHP_FUNCTION(xml_set_notation_decl_handler)
}
/* }}} */
-/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_external_entity_ref_handler(resource parser, string hdl)
Set up external entity reference handler */
PHP_FUNCTION(xml_set_external_entity_ref_handler)
{
@@ -1342,7 +1342,7 @@ PHP_FUNCTION(xml_set_external_entity_ref_handler)
}
/* }}} */
-/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_start_namespace_decl_handler(resource parser, string hdl)
Set up character data handler */
PHP_FUNCTION(xml_set_start_namespace_decl_handler)
{
@@ -1363,7 +1363,7 @@ PHP_FUNCTION(xml_set_start_namespace_decl_handler)
}
/* }}} */
-/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl)
+/* {{{ proto int xml_set_end_namespace_decl_handler(resource parser, string hdl)
Set up character data handler */
PHP_FUNCTION(xml_set_end_namespace_decl_handler)
{
@@ -1426,7 +1426,7 @@ PHP_FUNCTION(xml_parse_into_struct)
return;
}
- if (info) {
+ if (info) {
zval_ptr_dtor(info);
array_init(info);
}
@@ -1439,11 +1439,11 @@ PHP_FUNCTION(xml_parse_into_struct)
array_init(xdata);
ZVAL_COPY_VALUE(&parser->data, xdata);
-
+
if (info) {
ZVAL_COPY_VALUE(&parser->info, info);
}
-
+
parser->level = 0;
parser->ltags = safe_emalloc(XML_MAXLEVEL, sizeof(char *), 0);
@@ -1458,7 +1458,7 @@ PHP_FUNCTION(xml_parse_into_struct)
}
/* }}} */
-/* {{{ proto int xml_get_error_code(resource parser)
+/* {{{ proto int xml_get_error_code(resource parser)
Get XML parser error code */
PHP_FUNCTION(xml_get_error_code)
{
@@ -1495,7 +1495,7 @@ PHP_FUNCTION(xml_error_string)
}
/* }}} */
-/* {{{ proto int xml_get_current_line_number(resource parser)
+/* {{{ proto int xml_get_current_line_number(resource parser)
Get current line number for an XML parser */
PHP_FUNCTION(xml_get_current_line_number)
{
@@ -1533,7 +1533,7 @@ PHP_FUNCTION(xml_get_current_column_number)
}
/* }}} */
-/* {{{ proto int xml_get_current_byte_index(resource parser)
+/* {{{ proto int xml_get_current_byte_index(resource parser)
Get current byte index for an XML parser */
PHP_FUNCTION(xml_get_current_byte_index)
{
@@ -1552,7 +1552,7 @@ PHP_FUNCTION(xml_get_current_byte_index)
}
/* }}} */
-/* {{{ proto int xml_parser_free(resource parser)
+/* {{{ proto int xml_parser_free(resource parser)
Free an XML parser */
PHP_FUNCTION(xml_parser_free)
{
@@ -1580,7 +1580,7 @@ PHP_FUNCTION(xml_parser_free)
}
/* }}} */
-/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value)
+/* {{{ proto int xml_parser_set_option(resource parser, int option, mixed value)
Set options in an XML parser */
PHP_FUNCTION(xml_parser_set_option)
{
@@ -1633,7 +1633,7 @@ PHP_FUNCTION(xml_parser_set_option)
}
/* }}} */
-/* {{{ proto int xml_parser_get_option(resource parser, int option)
+/* {{{ proto int xml_parser_get_option(resource parser, int option)
Get options from an XML parser */
PHP_FUNCTION(xml_parser_get_option)
{
@@ -1666,7 +1666,7 @@ PHP_FUNCTION(xml_parser_get_option)
}
/* }}} */
-/* {{{ proto string utf8_encode(string data)
+/* {{{ proto string utf8_encode(string data)
Encodes an ISO-8859-1 string to UTF-8 */
PHP_FUNCTION(utf8_encode)
{
@@ -1686,7 +1686,7 @@ PHP_FUNCTION(utf8_encode)
}
/* }}} */
-/* {{{ proto string utf8_decode(string data)
+/* {{{ proto string utf8_decode(string data)
Converts a UTF-8 encoded string to ISO-8859-1 */
PHP_FUNCTION(utf8_decode)
{