]> diplodocus.org Git - nmh/blobdiff - sbr/seq_setprev.c
mhlsbr.c: Don't strchr(3) non-string NUL-less buffer.
[nmh] / sbr / seq_setprev.c
index 11de1439bff28c125277a884a405985ad0ace84d..5e5c43e9b6ce2a0c8b454017c0266daf34edebdb 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * seq_setprev.c -- set the Previous-Sequence
+/* seq_setprev.c -- set the Previous-Sequence
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -8,6 +6,7 @@
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 
 /*
  * Add all the messages currently SELECTED to
@@ -26,14 +25,12 @@ seq_setprev (struct msgs *mp)
      * Get the list of sequences for Previous-Sequence
      * and split them.
      */
-    if ((cp = context_find (psequence))) {
-       dp = getcpy (cp);
-       if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
-           free (dp);
-           return;
-       }
-    } else {
-       return;
+    if (!(cp = context_find(psequence)))
+        return;
+    dp = mh_xstrdup(cp);
+    if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
+        free(dp);
+        return;
     }
 
     /* Now add all SELECTED messages to each sequence */