]> diplodocus.org Git - nmh/commitdiff
In m_getfld(), fixed the loop that handles the FLDPLUS case.
authorDavid Levine <levinedl@acm.org>
Tue, 15 Jan 2013 03:05:22 +0000 (21:05 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 15 Jan 2013 03:05:22 +0000 (21:05 -0600)
In Getc(), removed the increment of the byte count at EOF,
it didn't seem correct or necessary.

sbr/m_getfld.c

index 8c58108046cfad2fe65adf0381f8b87c62b01032..e84e5550b8226484e43525014a97c843912ec0e7 100644 (file)
@@ -341,9 +341,6 @@ Getc (FILE *iob) {
        if (read_more (&m, iob) == 0) {
            /* Pretend that we read a character.  That's what stdio does. */
            ++m.readpos;
-           /* Don't seem to need the following but maybe because no
-              caller of m_getfld () looks at it. */
-           ++m.bytes_read;
            return EOF;
        }
     }
@@ -515,8 +512,9 @@ m_getfld (int state, unsigned char name[NAMESZ], unsigned char *buf,
             */
            cp = buf;
            i = *bufsz-1;
+           j = 0;
            for (;;) {
-               for (j = 0; c != '\n'  &&  c != EOF  &&  j++ <= i; ) {
+               while (c != '\n'  &&  c != EOF  &&  j++ < i) {
                    *cp++ = c = Getc (iob);
                }