mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: add [unsafe] tag to more functions: tos, string_from_wide, strings.Builder: write_bytes, free (#8766)
This commit is contained in:
@@ -142,11 +142,11 @@ fn get_reg_value(reg_env_key voidptr, key string) ?string {
|
||||
$if windows {
|
||||
// query the value (shortcut the sizing step)
|
||||
reg_value_size := 4095 // this is the max length (not for the registry, but for the system %PATH%)
|
||||
mut reg_value := &u16(malloc(reg_value_size))
|
||||
mut reg_value := unsafe { &u16(malloc(reg_value_size)) }
|
||||
if C.RegQueryValueEx(reg_env_key, key.to_wide(), 0, 0, reg_value, ®_value_size) != 0 {
|
||||
return error('Unable to get registry value for "$key", try rerunning as an Administrator')
|
||||
}
|
||||
return string_from_wide(reg_value)
|
||||
return unsafe { string_from_wide(reg_value) }
|
||||
}
|
||||
return error('not on windows')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user