aboutsummaryrefslogtreecommitdiffstats
path: root/g10/kbnode.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-02-16 20:05:02 +0000
committerWerner Koch <[email protected]>1998-02-16 20:05:02 +0000
commit82464369f664f821542c416d35d4013f9723f87a (patch)
treed127f2d891260ff1c6d4264630b2ba7bd463b1f4 /g10/kbnode.c
parentadded option export (diff)
downloadgnupg-82464369f664f821542c416d35d4013f9723f87a.tar.gz
gnupg-82464369f664f821542c416d35d4013f9723f87a.zip
some import functionality
Diffstat (limited to 'g10/kbnode.c')
-rw-r--r--g10/kbnode.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/g10/kbnode.c b/g10/kbnode.c
index 83ec50742..c28748b6e 100644
--- a/g10/kbnode.c
+++ b/g10/kbnode.c
@@ -61,7 +61,7 @@ release_kbnode( KBNODE n )
* Note: This does only work with walk_kbnode!!
*/
void
-delete_kbnode( KBNODE root, KBNODE node )
+delete_kbnode( KBNODE node )
{
node->private_flag |= 1;
}
@@ -196,3 +196,29 @@ clear_kbnode_flags( KBNODE n )
}
}
+
+/****************
+ * Commit changes made to the kblist at ROOT. Note that ROOT my change,
+ * and it is therefor passed by reference.
+ * The function has the effect of removing all nodes marked as deleted.
+ * returns true, if any node has been changed
+ */
+int
+commit_kbnode( KBNODE *root )
+{
+ KBNODE n, n2;
+ int changed = 0;
+
+ for(n=*root; n; n = n2 ) {
+ n2 = n->next;
+ if( (n->private_flag & 1) ) {
+ if( n == *root )
+ *root = n2;
+ free_packet( n->pkt );
+ m_free( n );
+ changed = 1;
+ }
+ }
+ return changed;
+}
+