X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/059ec3d9952740285fb1ebf47961b8aca2eb1b4a..e00aaee32157c44b9fc3175ed0d2a5b3ea376d66:/src/src/tree.c diff --git a/src/src/tree.c b/src/src/tree.c index 12592c100..a48b45790 100644 --- a/src/src/tree.c +++ b/src/src/tree.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/tree.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/tree.c,v 1.6 2009/11/16 19:50:37 nm4 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2004 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions for maintaining binary balanced trees and some associated @@ -342,4 +342,26 @@ return NULL; } + +/************************************************* +* Walk tree recursively and execute function * +*************************************************/ + +/* +Arguments: + p root of the tree + f function to execute for each name-value-pair + ctx context data for f +*/ + +void +tree_walk(tree_node *p, void (*f)(uschar*, uschar*, void*), void *ctx) +{ +if (p == NULL) return; +f(p->name, p->data.ptr, ctx); +if (p->left != NULL) tree_walk(p->left, f, ctx); +if (p->right != NULL) tree_walk(p->right, f, ctx); +} + + /* End of tree.c */