From 9ec5e89c859b70b03a65ff773f8f85eddc277f71 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 24 Jun 2021 07:47:48 -0700 Subject: parser: no string allocation when scanning floats. Each time the scanner processes a floating-point token, it allocates a string object, just so it can call flo_str. The object is then garbage. Let's stop doing that. * lib.c (flo_str_utf8): New function, closely based on flo_str. Takes a char * string. * lib.h (flo_str_utf8): Declared. * parser.l (out_of_range_float): Take the token as a const char * string instead of a Lisp string, so we can just pass yytext to this function. (grammar): Use flo_str_utf8 instead flo_str, and pass yytext to out_of_range_float. * lex.yy.c.shipped: Updated. --- lib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib.h') diff --git a/lib.h b/lib.h index 97a7dbd4..512c3462 100644 --- a/lib.h +++ b/lib.h @@ -894,6 +894,7 @@ val str_gt(val astr, val bstr); val str_le(val astr, val bstr); val str_ge(val astr, val bstr); val int_str(val str, val base); +val flo_str_utf8(const char *); val flo_str(val str); val num_str(val str); val int_flo(val f); -- cgit v1.2.3