Rocco Rutte:
[apps/madmutt.git] / pgplib.c
index eda1855..26b029b 100644 (file)
--- a/pgplib.c
+++ b/pgplib.c
@@ -1,22 +1,10 @@
 /*
+ * Copyright notice from original mutt:
  * Copyright (C) 1997-2000 Thomas Roessler <roessler@does-not-exist.org>
- * 
- *     This program is free software; you can redistribute it
- *     and/or modify it under the terms of the GNU General Public
- *     License as published by the Free Software Foundation; either
- *     version 2 of the License, or (at your option) any later
- *     version.
- * 
- *     This program is distributed in the hope that it will be
- *     useful, but WITHOUT ANY WARRANTY; without even the implied
- *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- *     PURPOSE.  See the GNU General Public License for more
- *     details.
- * 
- *     You should have received a copy of the GNU General Public
- *     License along with this program; if not, write to the Free
- *     Software Foundation, Inc., 59 Temple Place - Suite 330,
- *     Boston, MA  02111, USA.
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
  */
 
 /* Generally useful, pgp-related functions. */
@@ -35,6 +23,8 @@
 #include "lib.h"
 #include "pgplib.h"
 
+#include "lib/mem.h"
+
 const char *pgp_pkalgbytype (unsigned char type)
 {
   switch (type) {
@@ -126,7 +116,7 @@ void pgp_free_sig (pgp_sig_t ** sigp)
 
   for (sp = *sigp; sp; sp = q) {
     q = sp->next;
-    FREE (&sp);
+    mem_free (&sp);
   }
 
   *sigp = NULL;
@@ -141,8 +131,8 @@ void pgp_free_uid (pgp_uid_t ** upp)
   for (up = *upp; up; up = q) {
     q = up->next;
     pgp_free_sig (&up->sigs);
-    FREE (&up->addr);
-    FREE (&up);
+    mem_free (&up->addr);
+    mem_free (&up);
   }
 
   *upp = NULL;
@@ -154,10 +144,10 @@ pgp_uid_t *pgp_copy_uids (pgp_uid_t * up, pgp_key_t parent)
   pgp_uid_t **lp = &l;
 
   for (; up; up = up->next) {
-    *lp = safe_calloc (1, sizeof (pgp_uid_t));
+    *lp = mem_calloc (1, sizeof (pgp_uid_t));
     (*lp)->trust = up->trust;
     (*lp)->flags = up->flags;
-    (*lp)->addr = safe_strdup (up->addr);
+    (*lp)->addr = str_dup (up->addr);
     (*lp)->parent = parent;
     lp = &(*lp)->next;
   }
@@ -175,8 +165,8 @@ static void _pgp_free_key (pgp_key_t * kpp)
   kp = *kpp;
 
   pgp_free_uid (&kp->address);
-  FREE (&kp->keyid);
-  FREE (kpp);
+  mem_free (&kp->keyid);
+  mem_free (kpp);
 }
 
 pgp_key_t pgp_remove_key (pgp_key_t * klist, pgp_key_t key)