Skip to content

Commit 9cb5054

Browse files
committed
fix folding, move protos to the top of the sources
1 parent 7098176 commit 9cb5054

File tree

1 file changed

+53
-32
lines changed

1 file changed

+53
-32
lines changed

ext/simplexml/simplexml.c

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@
4343

4444
zend_class_entry *sxe_class_entry = NULL;
4545

46-
ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D)
46+
ZEND_API zend_class_entry *sxe_get_element_class_entry(TSRMLS_D) /* {{{ */
4747
{
4848
return sxe_class_entry;
4949
}
50+
/* }}} */
5051

5152
#define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags)
5253
#define SXE_MALIAS(func, alias, arg_info, flags) PHP_MALIAS(simplexml_element, func, alias, arg_info, flags)
@@ -59,6 +60,13 @@ static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRML
5960
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC);
6061
static zval *sxe_get_value(zval *z TSRMLS_DC);
6162

63+
static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC);
64+
static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC);
65+
static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
66+
static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
67+
static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC);
68+
static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC);
69+
6270
/* {{{ _node_as_zval()
6371
*/
6472
static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE_ITER itertype, char *name, xmlChar *nsprefix, int isprefix TSRMLS_DC)
@@ -104,7 +112,8 @@ static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value, SXE
104112
} \
105113
}
106114

107-
static xmlNodePtr php_sxe_get_first_node(php_sxe_object *sxe, xmlNodePtr node TSRMLS_DC) {
115+
static xmlNodePtr php_sxe_get_first_node(php_sxe_object *sxe, xmlNodePtr node TSRMLS_DC) /* {{{ */
116+
{
108117
php_sxe_object *intern;
109118
xmlNodePtr retnode = NULL;
110119

@@ -119,6 +128,7 @@ static xmlNodePtr php_sxe_get_first_node(php_sxe_object *sxe, xmlNodePtr node TS
119128
return node;
120129
}
121130
}
131+
/* }}} */
122132

123133
static inline int match_ns(php_sxe_object *sxe, xmlNodePtr node, xmlChar *name, int prefix) /* {{{ */
124134
{
@@ -1014,7 +1024,7 @@ static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval
10141024
}
10151025
/* }}} */
10161026

1017-
static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *value TSRMLS_DC)
1027+
static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *value TSRMLS_DC) /* {{{ */
10181028
{
10191029
zval **data_ptr;
10201030
zval *newptr;
@@ -1037,6 +1047,7 @@ static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *val
10371047
zend_hash_quick_update(rv, name, namelen, h, &value, sizeof(zval *), NULL);
10381048
}
10391049
}
1050+
/* }}} */
10401051

10411052
static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{{ */
10421053
{
@@ -1399,7 +1410,7 @@ SXE_METHOD(asXML)
13991410

14001411
#define SXE_NS_PREFIX(ns) (ns->prefix ? (char*)ns->prefix : "")
14011412

1402-
static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns TSRMLS_DC)
1413+
static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns TSRMLS_DC) /* {{{ */
14031414
{
14041415
uint prefix_len;
14051416
char *prefix = SXE_NS_PREFIX(ns);
@@ -1422,6 +1433,7 @@ static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns TSRMLS
14221433
}
14231434
}
14241435
}
1436+
/* }}} */
14251437

14261438
static void sxe_add_namespaces(php_sxe_object *sxe, xmlNodePtr node, zend_bool recursive, zval *return_value TSRMLS_DC) /* {{{ */
14271439
{
@@ -1857,7 +1869,7 @@ static int sxe_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
18571869
}
18581870
/* }}} */
18591871

1860-
static zval *sxe_get_value(zval *z TSRMLS_DC)
1872+
static zval *sxe_get_value(zval *z TSRMLS_DC) /* {{{ */
18611873
{
18621874
zval *retval;
18631875

@@ -1871,9 +1883,9 @@ static zval *sxe_get_value(zval *z TSRMLS_DC)
18711883
Z_SET_REFCOUNT_P(retval, 0);
18721884
return retval;
18731885
}
1886+
/* }}} */
18741887

1875-
1876-
static zend_object_handlers sxe_object_handlers = {
1888+
static zend_object_handlers sxe_object_handlers = { /* {{{ */
18771889
ZEND_OBJECTS_STORE_HANDLERS,
18781890
sxe_property_read,
18791891
sxe_property_write,
@@ -1897,6 +1909,7 @@ static zend_object_handlers sxe_object_handlers = {
18971909
sxe_count_elements,
18981910
sxe_get_debug_info
18991911
};
1912+
/* }}} */
19001913

19011914
/* {{{ sxe_object_clone()
19021915
*/
@@ -2128,7 +2141,6 @@ PHP_FUNCTION(simplexml_load_string)
21282141
}
21292142
/* }}} */
21302143

2131-
21322144
/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]]) U
21332145
SimpleXMLElement constructor */
21342146
SXE_METHOD(__construct)
@@ -2180,24 +2192,17 @@ SXE_METHOD(__construct)
21802192
}
21812193
/* }}} */
21822194

2183-
2184-
static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC);
2185-
static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC);
2186-
static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC);
2187-
static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC);
2188-
static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC);
2189-
static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC);
2190-
2191-
zend_object_iterator_funcs php_sxe_iterator_funcs = {
2195+
zend_object_iterator_funcs php_sxe_iterator_funcs = { /* {{{ */
21922196
php_sxe_iterator_dtor,
21932197
php_sxe_iterator_valid,
21942198
php_sxe_iterator_current_data,
21952199
php_sxe_iterator_current_key,
21962200
php_sxe_iterator_move_forward,
21972201
php_sxe_iterator_rewind,
21982202
};
2203+
/* }}} */
21992204

2200-
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC)
2205+
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data TSRMLS_DC) /* {{{ */
22012206
{
22022207
xmlChar *prefix = sxe->iter.nsprefix;
22032208
int isprefix = sxe->iter.isprefix;
@@ -2226,8 +2231,9 @@ static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, i
22262231

22272232
return node;
22282233
}
2234+
/* }}} */
22292235

2230-
static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRMLS_DC)
2236+
static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRMLS_DC) /* {{{ */
22312237
{
22322238
xmlNodePtr node;
22332239

@@ -2252,8 +2258,9 @@ static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data TSRML
22522258
}
22532259
return NULL;
22542260
}
2261+
/* }}} */
22552262

2256-
zend_object_iterator *php_sxe_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC)
2263+
zend_object_iterator *php_sxe_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */
22572264
{
22582265
php_sxe_iterator *iterator;
22592266

@@ -2269,8 +2276,9 @@ zend_object_iterator *php_sxe_get_iterator(zend_class_entry *ce, zval *object, i
22692276

22702277
return (zend_object_iterator*)iterator;
22712278
}
2279+
/* }}} */
22722280

2273-
static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
2281+
static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
22742282
{
22752283
php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
22762284

@@ -2281,22 +2289,25 @@ static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
22812289

22822290
efree(iterator);
22832291
}
2292+
/* }}} */
22842293

2285-
static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC)
2294+
static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
22862295
{
22872296
php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
22882297

22892298
return iterator->sxe->iter.data ? SUCCESS : FAILURE;
22902299
}
2300+
/* }}} */
22912301

2292-
static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
2302+
static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) /* {{{ */
22932303
{
22942304
php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
22952305

22962306
*data = &iterator->sxe->iter.data;
22972307
}
2308+
/* }}} */
22982309

2299-
static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
2310+
static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
23002311
{
23012312
zval *curobj;
23022313
xmlNodePtr curnode = NULL;
@@ -2329,8 +2340,9 @@ static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_ke
23292340
return HASH_KEY_IS_STRING;
23302341
}
23312342
}
2343+
/* }}} */
23322344

2333-
ZEND_API void php_sxe_move_forward_iterator(php_sxe_object *sxe TSRMLS_DC)
2345+
ZEND_API void php_sxe_move_forward_iterator(php_sxe_object *sxe TSRMLS_DC) /* {{{ */
23342346
{
23352347
xmlNodePtr node = NULL;
23362348
php_sxe_object *intern;
@@ -2346,14 +2358,16 @@ ZEND_API void php_sxe_move_forward_iterator(php_sxe_object *sxe TSRMLS_DC)
23462358
php_sxe_iterator_fetch(sxe, node->next, 1 TSRMLS_CC);
23472359
}
23482360
}
2361+
/* }}} */
23492362

2350-
static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
2363+
static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
23512364
{
23522365
php_sxe_iterator *iterator = (php_sxe_iterator *)iter;
23532366
php_sxe_move_forward_iterator(iterator->sxe TSRMLS_CC);
23542367
}
2368+
/* }}} */
23552369

2356-
static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC)
2370+
static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
23572371
{
23582372
php_sxe_object *sxe;
23592373

@@ -2362,8 +2376,9 @@ static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC)
23622376

23632377
php_sxe_reset_iterator(sxe, 1 TSRMLS_CC);
23642378
}
2379+
/* }}} */
23652380

2366-
void *simplexml_export_node(zval *object TSRMLS_DC)
2381+
void *simplexml_export_node(zval *object TSRMLS_DC) /* {{{ */
23672382
{
23682383
php_sxe_object *sxe;
23692384
xmlNodePtr node;
@@ -2372,6 +2387,7 @@ void *simplexml_export_node(zval *object TSRMLS_DC)
23722387
GET_NODE(sxe, node);
23732388
return php_sxe_get_first_node(sxe, node TSRMLS_CC);
23742389
}
2390+
/* }}} */
23752391

23762392
/* {{{ proto simplemxml_element simplexml_import_dom(domNode node [, string class_name]) U
23772393
Get a simplexml_element object from dom to allow for processing */
@@ -2419,19 +2435,21 @@ PHP_FUNCTION(simplexml_import_dom)
24192435
}
24202436
/* }}} */
24212437

2422-
const zend_function_entry simplexml_functions[] = {
2438+
const zend_function_entry simplexml_functions[] = { /* {{{ */
24232439
PHP_FE(simplexml_load_file, NULL)
24242440
PHP_FE(simplexml_load_string, NULL)
24252441
PHP_FE(simplexml_import_dom, NULL)
24262442
{NULL, NULL, NULL}
24272443
};
2444+
/* }}} */
24282445

2429-
static const zend_module_dep simplexml_deps[] = {
2446+
static const zend_module_dep simplexml_deps[] = { /* {{{ */
24302447
ZEND_MOD_REQUIRED("libxml")
24312448
{NULL, NULL, NULL}
24322449
};
2450+
/* }}} */
24332451

2434-
zend_module_entry simplexml_module_entry = {
2452+
zend_module_entry simplexml_module_entry = { /* {{{ */
24352453
STANDARD_MODULE_HEADER_EX, NULL,
24362454
simplexml_deps,
24372455
"SimpleXML",
@@ -2444,14 +2462,15 @@ zend_module_entry simplexml_module_entry = {
24442462
"0.1",
24452463
STANDARD_MODULE_PROPERTIES
24462464
};
2465+
/* }}} */
24472466

24482467
#ifdef COMPILE_DL_SIMPLEXML
24492468
ZEND_GET_MODULE(simplexml)
24502469
#endif
24512470

24522471
/* the method table */
24532472
/* each method can have its own parameters and visibility */
2454-
static const zend_function_entry sxe_functions[] = {
2473+
static const zend_function_entry sxe_functions[] = { /* {{{ */
24552474
SXE_ME(__construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
24562475
SXE_ME(asXML, NULL, ZEND_ACC_PUBLIC)
24572476
SXE_MALIAS(saveXML, asXML, NULL, ZEND_ACC_PUBLIC)
@@ -2466,6 +2485,7 @@ static const zend_function_entry sxe_functions[] = {
24662485
SXE_ME(addAttribute, NULL, ZEND_ACC_PUBLIC)
24672486
{NULL, NULL, NULL}
24682487
};
2488+
/* }}} */
24692489

24702490
/* {{{ PHP_MINIT_FUNCTION(simplexml)
24712491
*/
@@ -2504,6 +2524,7 @@ PHP_MSHUTDOWN_FUNCTION(simplexml)
25042524
return SUCCESS;
25052525
}
25062526
/* }}} */
2527+
25072528
/* {{{ PHP_MINFO_FUNCTION(simplexml)
25082529
*/
25092530
PHP_MINFO_FUNCTION(simplexml)

0 commit comments

Comments
 (0)