aboutsummaryrefslogtreecommitdiffstats
path: root/src/lang.c
diff options
context:
space:
mode:
authorGavin Howard <yzena.tech@gmail.com>2020-06-15 08:17:31 -0600
committerGavin Howard <yzena.tech@gmail.com>2020-06-15 08:17:31 -0600
commita41c6321409534a979a9fab2c96665df6669f2c4 (patch)
tree31e03a705b72d022d7aad7762b76dcdc3ebe6518 /src/lang.c
parent429bf64e6004fe68b7ca3d9e870e742ca19c89c6 (diff)
downloadplatform_external_bc-a41c6321409534a979a9fab2c96665df6669f2c4.tar.gz
platform_external_bc-a41c6321409534a979a9fab2c96665df6669f2c4.tar.bz2
platform_external_bc-a41c6321409534a979a9fab2c96665df6669f2c4.zip
Make bc not allocate the exprs and files vectors unless needed
This will save startup time when running in a script where everything is provided on stdin. It will also save time in the usual case where there are no expressions.
Diffstat (limited to 'src/lang.c')
-rw-r--r--src/lang.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/lang.c b/src/lang.c
index b4c514b4..2aede988 100644
--- a/src/lang.c
+++ b/src/lang.c
@@ -102,11 +102,7 @@ void bc_func_init(BcFunc *f, const char *name) {
if (BC_IS_BC || !strcmp(name, bc_func_main))
bc_vec_init(&f->strs, sizeof(char*), bc_string_free);
#if BC_ENABLE_FUNC_FREE
- else {
- f->strs.v = NULL;
- f->strs.len = 0;
- f->strs.dtor = NULL;
- }
+ else bc_vec_clear(&f->strs);
#endif // BC_ENABLE_FUNC_FREE
bc_vec_init(&f->consts, sizeof(BcConst), bc_const_free);