X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=blobdiff_plain;f=src%2Fsrc%2Ftree.c;h=2a9d90a62477fbdc6dbed4e423514de2f11adb62;hp=17216052bbacd2c321960cacd4059dc10b8c4672;hb=fb2bba55d3916ab1d515f1a060f19009daf447ed;hpb=d7d7b7b91dd75cec636fc144da7e27eed860f971 diff --git a/src/src/tree.c b/src/src/tree.c index 17216052b..2a9d90a62 100644 --- a/src/src/tree.c +++ b/src/src/tree.c @@ -1,10 +1,8 @@ -/* $Cambridge: exim/src/src/tree.c,v 1.3 2006/02/07 11:19:00 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2006 */ +/* 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 +340,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 */