avoid stack overflow

This commit is contained in:
rfm 2024-11-22 06:04:38 +00:00
parent 4c287f20b3
commit 99bb50d2c0
2 changed files with 9 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2024-11-22 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSIndex: (-makeRefs:) process child nodes in loop rather
than recursively ... reduces the depth of recursion to the depth of
nesting children rather than the number of children, avoiding stack
overflow for large projects.
2024-11-21 Richard Frith-Macdonald <rfm@gnu.org>
* NSRegularExpression: avoid leaks in ICU code by calling more

View file

@ -291,7 +291,6 @@ findKey(id refs, NSString *key, NSMutableArray *path, NSMutableArray *found)
- (void) makeRefs: (GSXMLNode*)node
{
GSXMLNode *children = [node firstChild];
GSXMLNode *next = [node next];
BOOL newUnit = NO;
if ([node type] == XML_ELEMENT_NODE)
@ -541,9 +540,10 @@ findKey(id refs, NSString *key, NSMutableArray *path, NSMutableArray *found)
}
}
if (children != nil)
while (children)
{
[self makeRefs: children];
children = [children next];
}
if (newUnit == YES)
{
@ -551,10 +551,6 @@ findKey(id refs, NSString *key, NSMutableArray *path, NSMutableArray *found)
category = nil;
classname = nil;
}
if (next != nil)
{
[self makeRefs: next];
}
}
/**