shithub: neatroff

Download patch

ref: f8e3db6d29a44708872dd51a57b74033fdac41b6
parent: 3229a5cd02f387a5718a086afefa22d92d87a43f
author: Ali Gholami Rudi <[email protected]>
date: Fri Oct 28 20:45:46 EDT 2022

cp: call num_str() only once when reading a number register

This makes processing some input files 10% faster.

--- a/cp.c
+++ b/cp.c
@@ -53,13 +53,14 @@
 {
 	int id;
 	int c = cp_noninext();
+	char *s;
 	if (c != '-' && c != '+')
 		cp_back(c);
 	id = regid();
 	if (c == '-' || c == '+')
 		num_inc(id, c == '+');
-	if (num_str(id))
-		in_push(num_str(id), NULL);
+	if ((s = num_str(id)) != NULL)
+		in_push(s, NULL);
 }
 
 /* interpolate \*(xy */