[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2887] Changed recursive algorithm with an iterative v
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [2887] Changed recursive algorithm with an iterative version. |
Date: |
Sat, 18 Oct 2008 12:30:21 +0000 |
Revision: 2887
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2887
Author: gscrivano
Date: 2008-10-18 12:30:19 +0000 (Sat, 18 Oct 2008)
Log Message:
-----------
Changed recursive algorithm with an iterative version.
Modified Paths:
--------------
trunk/myserver/src/conf/security/xml_validator.cpp
Modified: trunk/myserver/src/conf/security/xml_validator.cpp
===================================================================
--- trunk/myserver/src/conf/security/xml_validator.cpp 2008-10-16 20:56:42 UTC
(rev 2886)
+++ trunk/myserver/src/conf/security/xml_validator.cpp 2008-10-18 12:30:19 UTC
(rev 2887)
@@ -229,15 +229,31 @@
if (!node)
return 0;
- for (xmlNodePtr cur = node->children; cur; cur = cur->next)
+ xmlNodePtr cur = node->children;
+ for (;;)
{
+ if (cur->next == NULL)
+ {
+ cur = cur->parent;
+
+ /* The root is reached. */
+ if (cur == node)
+ return 1;
+
+ /* This should never happen. */
+ if (cur == NULL)
+ return 0;
+ }
+ else
+ cur = cur->next;
+
if (cur->type != XML_ELEMENT_NODE)
continue;
if (!xmlStrcmp (cur->name, (const xmlChar *) "CONDITION"))
{
- if (doCondition (cur, hashedDomains) && computeXmlNode (cur, st, cmd,
hashedDomains))
- return 1;
+ if (doCondition (cur, hashedDomains))
+ cur = cur->children;
}
else if (!xmlStrcmp (cur->name, (const xmlChar *) "RETURN"))
{
@@ -285,7 +301,7 @@
}
string *storedValue = getValue (hashedDomains, name);
-
+
if (!storedValue)
return false;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2887] Changed recursive algorithm with an iterative version.,
Giuseppe Scrivano <=