diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-08 23:15:04 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-08 23:15:04 +0000 |
commit | 9f9db797cbd47e8f4634e4d2aa46f0e8bce2caeb (patch) | |
tree | 4f454fd86486ee62721a38a17f334c0b3c301325 /usr.sbin/smtpd/aliases.c | |
parent | cb89fc166cda202180868bdf62a4da204ddf2db0 (diff) |
move expansion code to new expand.c to clearly separate it from aliases
Diffstat (limited to 'usr.sbin/smtpd/aliases.c')
-rw-r--r-- | usr.sbin/smtpd/aliases.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index c23871a0f87..325a23f4e6d 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.27 2009/11/08 23:08:56 gilles Exp $ */ +/* $OpenBSD: aliases.c,v 1.28 2009/11/08 23:15:03 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -488,44 +488,3 @@ alias_is_include(struct alias *alias, char *line, size_t len) alias->type = EXPAND_INCLUDE; return 1; } - -struct expand_node * -expandtree_lookup(struct expandtree *expandtree, struct expand_node *node) -{ - struct expand_node key; - - key = *node; - return RB_FIND(expandtree, expandtree, &key); -} - -void -expandtree_insert(struct expandtree *expandtree, struct expand_node *node) -{ - node->id = generate_uid(); - RB_INSERT(expandtree, expandtree, node); -} - -void -expandtree_remove(struct expandtree *expandtree, struct expand_node *node) -{ - struct expand_node *p; - - p = expandtree_lookup(expandtree, node); - if (p == NULL) - fatalx("expandtree_remove: node doesn't exist."); - RB_REMOVE(expandtree, expandtree, node); -} - -int -expand_cmp(struct expand_node *e1, struct expand_node *e2) -{ - if (e1->id < e2->id) - return -1; - - if (e1->id > e2->id) - return 1; - - return 0; -} - -RB_GENERATE(expandtree, expand_node, entry, expand_cmp); |