1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: use voidptr key methods: map_get_1, map_set_1, map_get_and_set_1 (#7390)

This commit is contained in:
Nick Treleaven
2020-12-18 23:05:16 +00:00
committed by GitHub
parent 6854ba27e2
commit 042449cd3d
5 changed files with 49 additions and 28 deletions

View File

@@ -458,7 +458,7 @@ fn (m map) get(key string, zero voidptr) voidptr {
// If `key` matches the key of an element in the container,
// the method returns a reference to its mapped value.
// If not, a zero/default value is returned.
fn (m map) get_1(key voidptr, zero voidptr) voidptr {
fn (m &map) get_1(key voidptr, zero voidptr) voidptr {
mut index, mut meta := m.key_to_index(key)
for {
if meta == unsafe {m.metas[index]} {
@@ -482,7 +482,7 @@ fn (m map) exists(key string) bool {
}
// Checks whether a particular key exists in the map.
fn (m map) exists_1(key voidptr) bool {
fn (m &map) exists_1(key voidptr) bool {
mut index, mut meta := m.key_to_index(key)
for {
if meta == unsafe {m.metas[index]} {