]> diplodocus.org Git - nmh/blobdiff - sbr/vfgets.c
uip/mhshowsbr.c: Increase buffer size for showing-content command.
[nmh] / sbr / vfgets.c
index beb0afd0a43853249c588c0250951e67eb87b65b..36f71379516ffe56a334053644e0cfb3257887d3 100644 (file)
@@ -1,8 +1,4 @@
-
-/*
- * vfgets.c -- virtual fgets
- *
- * $Id$
+/* vfgets.c -- virtual fgets
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -42,9 +38,8 @@ wrong_guess:
            if (*dp == '\n') {
                *bp = pp;
                return 0;
            if (*dp == '\n') {
                *bp = pp;
                return 0;
-           } else {
-               cp = ++dp;
            }
            }
+            cp = ++dp;
        } else {
            for (fp = dp - 1, toggle = 0; fp >= cp; fp--) {
                if (*fp != QUOTE)
        } else {
            for (fp = dp - 1, toggle = 0; fp >= cp; fp--) {
                if (*fp != QUOTE)
@@ -66,12 +61,9 @@ wrong_guess:
        if (cp >= ep) {
            int curlen = cp - pp;
 
        if (cp >= ep) {
            int curlen = cp - pp;
 
-           if (!(dp = realloc (pp, (size_t) (len += BUFSIZ)))) {
-               adios (NULL, "unable to allocate string storage");
-           } else {
-               cp = dp + curlen;
-               ep = (pp = dp) + len - 1;
-           }
+           dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+           cp = dp + curlen;
+           ep = (pp = dp) + len - 1;
        }
     }
 }
        }
     }
 }