From 66bf963a48053a103bc331f31f77af7b3fba7a65 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 23 Jun 2021 14:29:38 +0300 Subject: [PATCH] builtin: remove C.printf call from string.free() --- vlib/builtin/string.v | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 78bb2bd05b..b13a4c13b5 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -1496,10 +1496,12 @@ pub fn (s &string) free() { return } if s.is_lit == -98761234 { + double_free_msg := c'double string.free() detected\n' + double_free_msg_len := unsafe { vstrlen(double_free_msg) } $if freestanding { - bare_eprint(c'double string.free() detected\n', 30) + bare_eprint(double_free_msg, u64(double_free_msg_len)) } $else { - C.printf(c'double string.free() detected\n') + _write_buf_to_fd(1, double_free_msg, double_free_msg_len) } return }