From c8e0d37f4152d1341ef562a190fce93a0386a759 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 5 Sep 2016 08:31:25 +0200 Subject: gpg: Use a common filter_getval for import and export. * g10/import.c (filter_getval): Rename to ... (impex_filter_getval): this. Make global. (apply_keep_uid_filter, apply_drop_sig_filter): Adjust. * g10/export.c (filter_getval): Remove. (apply_drop_sig_filter): Use impex_filter_getval. Signed-off-by: Werner Koch --- g10/export.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'g10/export.c') diff --git a/g10/export.c b/g10/export.c index 8c158684d..e0699db03 100644 --- a/g10/export.c +++ b/g10/export.c @@ -1293,37 +1293,6 @@ write_keyblock_to_output (kbnode_t keyblock, int with_armor, } -/* Helper for apply_keep_uid_filter. */ -static const char * -filter_getval (void *cookie, const char *propname) -{ - kbnode_t node = cookie; - const char *result; - - if (node->pkt->pkttype == PKT_USER_ID) - { - if (!strcmp (propname, "uid")) - result = node->pkt->pkt.user_id->name; - else if (!strcmp (propname, "mbox")) - { - if (!node->pkt->pkt.user_id->mbox) - { - node->pkt->pkt.user_id->mbox - = mailbox_from_userid (node->pkt->pkt.user_id->name); - } - return node->pkt->pkt.user_id->mbox; - } - else if (!strcmp (propname, "primary")) - result = node->pkt->pkt.user_id->is_primary? "1":"0"; - else - result = NULL; - } - else - result = NULL; - - return result; -} - /* * Apply the keep-uid filter to the keyblock. The deleted nodes are * marked and thus the caller should call commit_kbnode afterwards. @@ -1338,7 +1307,7 @@ apply_keep_uid_filter (kbnode_t keyblock, recsel_expr_t selector) { if (node->pkt->pkttype == PKT_USER_ID) { - if (!recsel_select (selector, filter_getval, node)) + if (!recsel_select (selector, impex_filter_getval, node)) { /* log_debug ("keep-uid: deleting '%s'\n", */ /* node->pkt->pkt.user_id->name); */ -- cgit v1.2.3