Skip to content

Commit e59c7f8

Browse files
committed
ext/libxml: Reduce scope of variables
1 parent a7cc447 commit e59c7f8

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

ext/libxml/libxml.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,8 @@ static void php_libxml_node_free(xmlNodePtr node)
322322

323323
PHP_LIBXML_API void php_libxml_node_free_list(xmlNodePtr node)
324324
{
325-
xmlNodePtr curnode;
326-
327325
if (node != NULL) {
328-
curnode = node;
326+
xmlNodePtr curnode = node;
329327
while (curnode != NULL) {
330328
/* If the _private field is set, there's still a userland reference somewhere. We'll delay freeing in this case. */
331329
if (curnode->_private) {
@@ -1157,13 +1155,11 @@ PHP_FUNCTION(libxml_get_last_error)
11571155
/* {{{ Retrieve array of errors */
11581156
PHP_FUNCTION(libxml_get_errors)
11591157
{
1160-
xmlErrorPtr error;
1161-
11621158
ZEND_PARSE_PARAMETERS_NONE();
11631159

11641160
if (LIBXML(error_list)) {
11651161
array_init(return_value);
1166-
error = zend_llist_get_first(LIBXML(error_list));
1162+
xmlErrorPtr error = zend_llist_get_first(LIBXML(error_list));
11671163

11681164
while (error != NULL) {
11691165
zval z_error;
@@ -1285,16 +1281,15 @@ zval *php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node ex
12851281

12861282
PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object)
12871283
{
1288-
zend_class_entry *ce = NULL;
12891284
xmlNodePtr node = NULL;
1290-
php_libxml_func_handler *export_hnd;
12911285

12921286
if (Z_TYPE_P(object) == IS_OBJECT) {
1293-
ce = Z_OBJCE_P(object);
1287+
zend_class_entry *ce = Z_OBJCE_P(object);
12941288
while (ce->parent != NULL) {
12951289
ce = ce->parent;
12961290
}
1297-
if ((export_hnd = zend_hash_find_ptr(&php_libxml_exports, ce->name))) {
1291+
php_libxml_func_handler *export_hnd = zend_hash_find_ptr(&php_libxml_exports, ce->name);
1292+
if (export_hnd) {
12981293
node = export_hnd->export_func(object);
12991294
}
13001295
}

0 commit comments

Comments
 (0)