Changeset 101d84f for protocols/jabber/xmltree.c
 Timestamp:
 20061005T22:55:54Z (18 years ago)
 Branches:
 master
 Children:
 090f1cb
 Parents:
 cc2cb2d
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

protocols/jabber/xmltree.c
rcc2cb2d r101d84f 152 152 /* Find completed nodes and see if a handler has to be called. Passing 153 153 a node isn't necessary if you want to start at the root, just pass 154 NULL. This second argument is needed for recursive calls. FIXME: Retval?*/155 int xt_handle( struct xt_parser *xt, struct xt_node *node )154 NULL. This second argument is needed for recursive calls. */ 155 int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ) 156 156 { 157 157 struct xt_node *c; … … 159 159 int i; 160 160 161 /* Let's just hope xt>root isn't NULL! */ 161 /* Just in case someone likes infinite loops... */ 162 if( xt>root == NULL ) 163 return 0; 164 162 165 if( node == NULL ) 163 return xt_handle( xt, xt>root ); 164 165 for( c = node>children; c; c = c>next ) 166 if( !xt_handle( xt, c ) ) 167 return 0; 166 return xt_handle( xt, xt>root, depth ); 167 168 if( depth != 0 ) 169 for( c = node>children; c; c = c>next ) 170 if( !xt_handle( xt, c, depth > 0 ? depth  1 : depth ) ) 171 return 0; 168 172 169 173 if( node>flags & XT_COMPLETE && !( node>flags & XT_SEEN ) ) … … 202 206 streams because there's no reason to keep a complete packet history 203 207 in memory. */ 204 void xt_cleanup( struct xt_parser *xt, struct xt_node *node )208 void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) 205 209 { 206 210 struct xt_node *c, *prev; … … 210 214 211 215 if( node == NULL ) 212 return xt_cleanup( xt, xt>root );216 return xt_cleanup( xt, xt>root, depth ); 213 217 214 218 if( node>flags & XT_SEEN && node == xt>root ) … … 246 250 /* This node can't be cleaned up yet, but maybe a 247 251 subnode can. */ 248 xt_cleanup( xt, c ); 252 if( depth != 0 ) 253 xt_cleanup( xt, c, depth > 0 ? depth  1 : depth ); 249 254 } 250 255 }
Note: See TracChangeset
for help on using the changeset viewer.