@@ -31,27 +31,20 @@ struct _nodeIterator {
31
31
xmlNode * node ;
32
32
};
33
33
34
- typedef struct _notationIterator notationIterator ;
35
- struct _notationIterator {
36
- int cur ;
37
- int index ;
38
- xmlNotation * notation ;
39
- };
40
-
41
34
/* Function pointer typedef changed in 2.9.8, see https://github.com/GNOME/libxml2/commit/e03f0a199a67017b2f8052354cf732b2b4cae787 */
42
35
#if LIBXML_VERSION >= 20908
43
36
static void itemHashScanner (void * payload , void * data , const xmlChar * name ) /* {{{ */
44
37
#else
45
38
static void itemHashScanner (void * payload , void * data , xmlChar * name )
46
39
#endif
47
40
{
48
- nodeIterator * priv = ( nodeIterator * ) data ;
41
+ nodeIterator * priv = data ;
49
42
50
- if (priv -> cur < priv -> index ) {
43
+ if (priv -> cur < priv -> index ) {
51
44
priv -> cur ++ ;
52
45
} else {
53
- if (priv -> node == NULL ) {
54
- priv -> node = ( xmlNode * ) payload ;
46
+ if (priv -> node == NULL ) {
47
+ priv -> node = payload ;
55
48
}
56
49
}
57
50
}
@@ -104,22 +97,11 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */
104
97
105
98
xmlNode * php_dom_libxml_notation_iter (xmlHashTable * ht , int index ) /* {{{ */
106
99
{
107
- notationIterator * iter ;
108
- xmlNotation * notep = NULL ;
109
- int htsize ;
110
-
111
- if ((htsize = xmlHashSize (ht )) > 0 && index < htsize ) {
112
- iter = emalloc (sizeof (notationIterator ));
113
- iter -> cur = 0 ;
114
- iter -> index = index ;
115
- iter -> notation = NULL ;
116
- xmlHashScan (ht , itemHashScanner , iter );
117
- notep = iter -> notation ;
118
- efree (iter );
119
- return create_notation (notep -> name , notep -> PublicID , notep -> SystemID );
120
- } else {
121
- return NULL ;
100
+ xmlNotation * notation = (xmlNotation * ) php_dom_libxml_hash_iter (ht , index );
101
+ if (notation != NULL ) {
102
+ return create_notation (notation -> name , notation -> PublicID , notation -> SystemID );
122
103
}
104
+ return NULL ;
123
105
}
124
106
/* }}} */
125
107
0 commit comments