From f8e3db6d29a44708872dd51a57b74033fdac41b6 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Sat, 29 Oct 2022 00:45:46 +0330 Subject: [PATCH] cp: call num_str() only once when reading a number register This makes processing some input files 10% faster. --- cp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cp.c b/cp.c index 165175c..17a5ee5 100644 --- a/cp.c +++ b/cp.c @@ -53,13 +53,14 @@ static void cp_num(void) { 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 */ -- 2.11.4.GIT