diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index a7f5b14257..57616b6750 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -742,7 +742,7 @@ pub fn (s string) index(p string) ?int { } // index_kmp does KMP search. -[manualfree] +[direct_array_access; manualfree] fn (s string) index_kmp(p string) int { if p.len > s.len { return -1 diff --git a/vlib/rand/seed/seed.v b/vlib/rand/seed/seed.v index 5e9fb76ad2..3b1ef7a607 100644 --- a/vlib/rand/seed/seed.v +++ b/vlib/rand/seed/seed.v @@ -14,8 +14,8 @@ fn nr_next(prev u32) u32 { // time_seed_array returns the required number of u32s generated from system time. [inline] pub fn time_seed_array(count int) []u32 { - ctime := time.now() - mut seed := u32(ctime.unix_time() ^ ctime.microsecond) + ctime := time.sys_mono_now() + mut seed := u32(ctime >> 32 ^ (ctime & 0x0000_0000_FFFF_FFFF)) mut seed_data := []u32{cap: count} for _ in 0 .. count { seed = nr_next(seed) diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index 3d7101c2eb..6ec6ec11a1 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -764,12 +764,12 @@ pub fn (mut t Table) find_or_register_thread(return_type Type) int { pub fn (mut t Table) find_or_register_array(elem_type Type) int { name := t.array_name(elem_type) - cname := t.array_cname(elem_type) // existing existing_idx := t.type_idxs[name] if existing_idx > 0 { return existing_idx } + cname := t.array_cname(elem_type) // register array_type_ := TypeSymbol{ parent_idx: array_type_idx diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 47d350f08d..58b4806fe5 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -5231,10 +5231,16 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) { } // g.zero_struct_fields(info, inited_fields) // nr_fields = info.fields.len - for field in info.fields { + for mut field in info.fields { if mut sym.info is ast.Struct { - equal_fields := sym.info.fields.filter(it.name == field.name) - if equal_fields.len == 0 { + mut found_equal_fields := 0 + for mut sifield in sym.info.fields { + if sifield.name == field.name { + found_equal_fields++ + break + } + } + if found_equal_fields == 0 { continue } }