nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] nmh/uip mhfree.c mhlist.c mhn.c mhshow.c mhstor...


From: Joel Reicher
Subject: [Nmh-commits] nmh/uip mhfree.c mhlist.c mhn.c mhshow.c mhstor...
Date: Sun, 04 Nov 2007 08:52:17 +0000

CVSROOT:        /sources/nmh
Module name:    nmh
Changes by:     Joel Reicher <jjr>      07/11/04 08:52:17

Modified files:
        uip            : mhfree.c mhlist.c mhn.c mhshow.c mhstore.c 
                         mhtest.c 

Log message:
        Refactor cts pointer and free()ing on abnormal exit of associated list
        into mhfree.c, eliminating duplication.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhfree.c?cvsroot=nmh&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhlist.c?cvsroot=nmh&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhn.c?cvsroot=nmh&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhshow.c?cvsroot=nmh&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhstore.c?cvsroot=nmh&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhtest.c?cvsroot=nmh&r1=1.13&r2=1.14

Patches:
Index: mhfree.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhfree.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- mhfree.c    18 Feb 2006 16:26:37 -0000      1.5
+++ mhfree.c    4 Nov 2007 08:52:17 -0000       1.6
@@ -3,7 +3,7 @@
  * mhfree.c -- routines to free the data structures used to
  *          -- represent MIME messages
  *
- * $Id: mhfree.c,v 1.5 2006/02/18 16:26:37 levine Exp $
+ * $Id: mhfree.c,v 1.6 2007/11/04 08:52:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -15,6 +15,9 @@
 #include <h/mime.h>
 #include <h/mhparse.h>
 
+/* The list of top-level contents to display */
+CT *cts = NULL;
+
 /*
  * prototypes
  */
@@ -22,6 +25,7 @@
 void free_header (CT);
 void free_ctinfo (CT);
 void free_encoding (CT, int);
+int freects_done (int);
 
 /*
  * static prototypes
@@ -281,3 +285,17 @@
        ct->c_ceopenfnx = NULL;
     }
 }
+
+
+int
+freects_done (int status)
+{
+    CT *ctp;
+
+    if ((ctp = cts))
+       for (; *ctp; ctp++)
+           free_content (*ctp);
+
+    exit (status);
+    return 1;  /* dead code to satisfy the compiler */
+}

Index: mhlist.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhlist.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mhlist.c    4 Nov 2007 04:47:18 -0000       1.13
+++ mhlist.c    4 Nov 2007 08:52:17 -0000       1.14
@@ -2,7 +2,7 @@
 /*
  * mhlist.c -- list the contents of MIME messages
  *
- * $Id: mhlist.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
+ * $Id: mhlist.c,v 1.14 2007/11/04 08:52:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -93,9 +93,6 @@
 int debugsw = 0;
 int verbosw = 0;
 
-/* The list of top-level contents to display */
-CT *cts = NULL;
-
 #define        quitser pipeser
 
 /* mhparse.c */
@@ -112,12 +109,13 @@
 
 /* mhfree.c */
 void free_content (CT);
+extern CT *cts;
+int freects_done (int);
 
 /*
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
-static int freectp_done (int);
 
 
 int
@@ -132,7 +130,7 @@
     struct msgs *mp = NULL;
     CT ct, *ctp;
 
-    done=freectp_done;
+    done=freects_done;
 
 #ifdef LOCALE
     setlocale(LC_ALL, "");
@@ -392,17 +390,3 @@
     done (1);
     /* NOTREACHED */
 }
-
-
-static int
-freectp_done (int status)
-{
-    CT *ctp;
-
-    if ((ctp = cts))
-       for (; *ctp; ctp++)
-           free_content (*ctp);
-
-    exit (status);
-    return 1;  /* dead code to satisfy the compiler */
-}

Index: mhn.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhn.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mhn.c       4 Nov 2007 04:47:18 -0000       1.13
+++ mhn.c       4 Nov 2007 08:52:17 -0000       1.14
@@ -2,7 +2,7 @@
 /*
  * mhn.c -- display, list, cache, or store the contents of MIME messages
  *
- * $Id: mhn.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
+ * $Id: mhn.c,v 1.14 2007/11/04 08:52:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -157,9 +157,6 @@
 int debugsw = 0;
 int verbosw = 0;
 
-/* The list of top-level contents to display */
-CT *cts = NULL;
-
 /*
  * variables for mhbuild (mhn -build)
  */
@@ -200,12 +197,13 @@
 
 /* mhfree.c */
 void free_content (CT);
+extern CT *cts;
+int freects_done (int);
 
 /*
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
-static int freectp_done (int);
 
 
 int
@@ -221,7 +219,7 @@
     CT ct, *ctp;
     FILE *fp;
 
-    done=freectp_done;
+    done=freects_done;
 
 #ifdef LOCALE
     setlocale(LC_ALL, "");
@@ -705,17 +703,3 @@
     done (1);
     /* NOTREACHED */
 }
-
-
-static int
-freectp_done (int status)
-{
-    CT *ctp;
-
-    if ((ctp = cts))
-       for (; *ctp; ctp++)
-           free_content (*ctp);
-
-    exit (status);
-    return 1;  /* dead code to satisfy the compiler */
-}

Index: mhshow.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhshow.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mhshow.c    4 Nov 2007 04:47:18 -0000       1.13
+++ mhshow.c    4 Nov 2007 08:52:17 -0000       1.14
@@ -2,7 +2,7 @@
 /*
  * mhshow.c -- display the contents of MIME messages
  *
- * $Id: mhshow.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
+ * $Id: mhshow.c,v 1.14 2007/11/04 08:52:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -109,9 +109,6 @@
 int debugsw = 0;
 int verbosw = 0;
 
-/* The list of top-level contents to display */
-CT *cts = NULL;
-
 #define        quitser pipeser
 
 /* mhparse.c */
@@ -128,12 +125,13 @@
 
 /* mhfree.c */
 void free_content (CT);
+extern CT *cts;
+int freects_done (int);
 
 /*
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
-static int freectp_done (int);
 
 
 int
@@ -148,7 +146,7 @@
     CT ct, *ctp;
     FILE *fp;
 
-    done=freectp_done;
+    done=freects_done;
 
 #ifdef LOCALE
     setlocale(LC_ALL, "");
@@ -472,17 +470,3 @@
     done (1);
     /* NOTREACHED */
 }
-
-
-static int
-freectp_done (int status)
-{
-    CT *ctp;
-
-    if ((ctp = cts))
-       for (; *ctp; ctp++)
-           free_content (*ctp);
-
-    exit (status);
-    return 1;  /* dead code to satisfy the compiler */
-}

Index: mhstore.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhstore.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mhstore.c   4 Nov 2007 04:47:18 -0000       1.13
+++ mhstore.c   4 Nov 2007 08:52:17 -0000       1.14
@@ -2,7 +2,7 @@
 /*
  * mhstore.c -- store the contents of MIME messages
  *
- * $Id: mhstore.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
+ * $Id: mhstore.c,v 1.14 2007/11/04 08:52:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -87,9 +87,6 @@
 int debugsw = 0;
 int verbosw = 0;
 
-/* The list of top-level contents to display */
-CT *cts = NULL;
-
 #define        quitser pipeser
 
 /* mhparse.c */
@@ -106,12 +103,13 @@
 
 /* mhfree.c */
 void free_content (CT);
+extern CT *cts;
+int freects_done (int);
 
 /*
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
-static int freectp_done (int);
 
 
 int
@@ -126,7 +124,7 @@
     CT ct, *ctp;
     FILE *fp;
 
-    done=freectp_done;
+    done=freects_done;
 
 #ifdef LOCALE
     setlocale(LC_ALL, "");
@@ -404,17 +402,3 @@
     done (1);
     /* NOTREACHED */
 }
-
-
-static int
-freectp_done (int status)
-{
-    CT *ctp;
-
-    if ((ctp = cts))
-       for (; *ctp; ctp++)
-           free_content (*ctp);
-
-    exit (status);
-    return 1;  /* dead code to satisfy the compiler */
-}

Index: mhtest.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhtest.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- mhtest.c    4 Nov 2007 04:47:18 -0000       1.13
+++ mhtest.c    4 Nov 2007 08:52:17 -0000       1.14
@@ -2,7 +2,7 @@
 /*
  * mhtest.c -- test harness for MIME routines
  *
- * $Id: mhtest.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
+ * $Id: mhtest.c,v 1.14 2007/11/04 08:52:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -89,9 +89,6 @@
 int debugsw = 0;
 int verbosw = 0;
 
-/* The list of top-level contents to display */
-CT *cts = NULL;
-
 #define        quitser pipeser
 
 /* mhparse.c */
@@ -108,13 +105,14 @@
 
 /* mhfree.c */
 void free_content (CT);
+extern CT *cts;
+int freects_done (int);
 
 /*
  * static prototypes
  */
 static int write_content (CT *, char *);
 static RETSIGTYPE pipeser (int);
-static int freectp_done (int);
 
 
 int
@@ -128,7 +126,7 @@
     struct msgs *mp = NULL;
     CT ct, *ctp;
 
-    done=freectp_done;
+    done=freects_done;
 
 #ifdef LOCALE
     setlocale(LC_ALL, "");
@@ -398,17 +396,3 @@
     done (1);
     /* NOTREACHED */
 }
-
-
-static int
-freectp_done (int status)
-{
-    CT *ctp;
-
-    if ((ctp = cts))
-       for (; *ctp; ctp++)
-           free_content (*ctp);
-
-    exit (status);
-    return 1;  /* dead code to satisfy the compiler */
-}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]