summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/aliases.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2009-11-08 23:20:08 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2009-11-08 23:20:08 +0000
commita46bd01b9b1c9dc94fcf086229dbd5c50e8a6801 (patch)
tree62aee8b14088670df56b6465691cd8ed56c9a7b8 /usr.sbin/smtpd/aliases.c
parent9f9db797cbd47e8f4634e4d2aa46f0e8bce2caeb (diff)
add an alias_to_expand_node() function and use it in aliases.c
Diffstat (limited to 'usr.sbin/smtpd/aliases.c')
-rw-r--r--usr.sbin/smtpd/aliases.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c
index 325a23f4e6d..9e568e19444 100644
--- a/usr.sbin/smtpd/aliases.c
+++ b/usr.sbin/smtpd/aliases.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aliases.c,v 1.28 2009/11/08 23:15:03 gilles Exp $ */
+/* $OpenBSD: aliases.c,v 1.29 2009/11/08 23:20:07 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -127,8 +127,7 @@ aliases_get(struct smtpd *env, objid_t mapid, struct expandtree *expandtree, cha
expnode = calloc(sizeof(struct expand_node), 1);
if (expnode == NULL)
fatal("aliases_get: calloc");
- expnode->type = alias.type;
- expnode->u = alias.u;
+ alias_to_expand_node(expnode, &alias);
expandtree_insert(expandtree, expnode);
}
} while (--nbaliases);
@@ -303,8 +302,7 @@ aliases_virtual_get(struct smtpd *env, objid_t mapid,
expnode = calloc(sizeof(struct expand_node), 1);
if (expnode== NULL)
fatal("aliases_virtual_get: calloc");
- expnode->type = alias.type;
- expnode->u = alias.u;
+ alias_to_expand_node(expnode, &alias);
expandtree_insert(expandtree, expnode);
}
} while (--nbaliases);
@@ -345,8 +343,7 @@ aliases_expand_include(struct expandtree *expandtree, char *filename)
expnode = calloc(sizeof(struct expand_node), 1);
if (expnode== NULL)
fatal("aliases_virtual_get: calloc");
- expnode->type = alias.type;
- expnode->u = alias.u;
+ alias_to_expand_node(expnode, &alias);
expandtree_insert(expandtree, expnode);
}
@@ -488,3 +485,10 @@ alias_is_include(struct alias *alias, char *line, size_t len)
alias->type = EXPAND_INCLUDE;
return 1;
}
+
+void
+alias_to_expand_node(struct expand_node *expnode, struct alias *alias)
+{
+ expnode->type = alias->type;
+ expnode->u = alias->u;
+}