shithub: neatroff

Download patch

ref: e17e491c13f8cc81ab1c9cb519441c376686e91b
parent: cb8744b2dfdb19eac2358bea7f8ef2c698b3cbef
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Aug 8 18:24:00 EDT 2014

in: remove in_last[]

--- a/in.c
+++ b/in.c
@@ -21,7 +21,6 @@
 static char files[NFILES][PATHLEN];
 static int nfiles;
 static int cfile;
-static int in_last[2] = {'\n'};	/* the last chars returned from in_next() */
 
 static char **args_init(char **args);
 static void args_free(char **args);
@@ -106,7 +105,7 @@
 	return !buf;
 }
 
-static int in_read(void)
+int in_next(void)
 {
 	int c;
 	while (buf || !in_nextfile()) {
@@ -124,21 +123,10 @@
 	return buf ? (unsigned char) buf->buf[buf->pos++] : -1;
 }
 
-int in_next(void)
-{
-	int c = in_read();
-	if (c >= 0) {
-		in_last[1] = in_last[0];
-		in_last[0] = c;
-	}
-	return c;
-}
-
 void in_back(int c)
 {
 	if (c < 0)
 		return;
-	in_last[0] = in_last[1];
 	if (buf)
 		buf->unbuf[buf->un++] = c;
 }