diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index 24b9d92f57..f416eb9abf 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -186,10 +186,10 @@ fn new_array_from_c_array_no_alloc(len int, cap int, elm_size int, c_array voidp return arr } -// Private function. Increases the `cap` of an array to the -// required value by copying the data to a new memory location -// (creating a clone) unless `a.cap` is already large enough. -fn (mut a array) ensure_cap(required int) { +// ensure_cap increases the `cap` of an array to the required value +// by copying the data to a new memory location (creating a clone), +// unless `a.cap` is already large enough. +pub fn (mut a array) ensure_cap(required int) { if required <= a.cap { return } diff --git a/vlib/strings/builder_test.v b/vlib/strings/builder_test.v index 9ca8c354e7..a981950e2c 100644 --- a/vlib/strings/builder_test.v +++ b/vlib/strings/builder_test.v @@ -183,7 +183,7 @@ fn test_grow_len() { assert sb.len == 20 assert sb.cap == 20 - unsafe { sb.ensure_cap(35) } + sb.ensure_cap(35) assert sb.len == 20 assert sb.cap == 35