[apparmor] [PATCH 03/20] Rework depth first traversal of expr trees

Kees Cook kees.cook at canonical.com
Fri Nov 5 07:24:22 GMT 2010


Hi John,

On Fri, Nov 05, 2010 at 01:50:59AM -0400, John Johansen wrote:
> Rework the depth first traversal of expr trees, to remove the use of the
> unneeded visited table, and give a little speed up and cleanup.
>...
> +        while (dynamic_cast<InnerNode *>(node)) {
> +	    pos.push(node->child[0]);
> +            node = node->child[0];
> +        }
>...
> +        Node *last = pos.top();
> +	pos.pop();
> +
> +	if (!pos.empty()) {
> +  	    /* no need to dynamic cast, as we just popped a node so the top node
> +	     * must be an inner node */
> +	    InnerNode *node = (InnerNode *)(pos.top());
> +
> +	    if (node->child[1] && node->child[1] != last) {
> +		push_left(node->child[1]);
> +	    }
>  	}
>      }
>  };

Looks like some whitespace intermix in this one. As for the content, what
was "visited" actually tracking? The change here isn't entirely obvious to
me.

-Kees

-- 
Kees Cook
Ubuntu Security Team



More information about the AppArmor mailing list