summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-07-22 07:07:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-07-22 07:07:51 -0700
commit74d7277b99dfe15797464f41adc5204c728eca6b (patch)
tree49430c9f8b4b101b93c1dad2ed59915c62da1797 /lib.h
parenta8ea27fae5dea57c9d5966d06c78ee64decfc8c7 (diff)
downloadtxr-74d7277b99dfe15797464f41adc5204c728eca6b.tar.gz
txr-74d7277b99dfe15797464f41adc5204c728eca6b.tar.bz2
txr-74d7277b99dfe15797464f41adc5204c728eca6b.zip
parser: remove some wasteful string object allocations.
* lib.c (int_str_wc): New function, made out of int_str. This can be used by the parser to work with a wchar_t * string without having to create a string object. (int_str): Implemented in terms of int_str_wc. * parser.l (grammar): Remove string_own calls from numerous rule bodies that use int_str to return a number. These rules now capture the wchar_t string, pass it to int_str_wc and then immediately free it. Whereas string_own allocates an extra object and leaves it to the garbage collector. * lex.yy.c.shipped: Regenerated.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index 5bc180df..79ac403f 100644
--- a/lib.h
+++ b/lib.h
@@ -1135,6 +1135,7 @@ val str_lt(val astr, val bstr);
val str_gt(val astr, val bstr);
val str_le(val astr, val bstr);
val str_ge(val astr, val bstr);
+val int_str_wc(const wchar_t *, val base);
val int_str(val str, val base);
val flo_str_utf8(const char *);
val flo_str(val str);