shithub: neatroff

Download patch

ref: 9dafaab5aeb1533792b3e134ada90d5ab9a4d635
parent: 46bff4d5c16fdc4716f6a2590acd374b2a5f547f
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sat May 4 15:50:05 EDT 2013

ren: increase the size of ren_back() buffer

This is necessary in schar_jump(), for instance, for \w\(ts\(rn\(ts.

--- a/ren.c
+++ b/ren.c
@@ -23,8 +23,9 @@
 static int ren_div;		/* rendering a diversion */
 
 static struct wb ren_wb;	/* the main ren.c word buffer */
-static int ren_backed = -1;	/* pushed back character */
 static int ren_nl;		/* just after newline */
+static int ren_unbuf[8];	/* ren_back() buffer */
+static int ren_un;
 
 static int bp_first = 1;	/* prior to the first page */
 static int bp_next = 1;		/* next page number */
@@ -32,14 +33,12 @@
 
 static int ren_next(void)
 {
-	int c = ren_backed >= 0 ? ren_backed : tr_next();
-	ren_backed = -1;
-	return c;
+	return ren_un > 0 ? ren_unbuf[--ren_un] : tr_next();
 }
 
 static void ren_back(int c)
 {
-	ren_backed = c;
+	ren_unbuf[ren_un++] = c;
 }
 
 void tr_di(char **args)