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

os_win.v: switch => match

This commit is contained in:
Nicolas Sauzede 2019-10-27 07:36:40 +01:00 committed by Alexander Medvednikov
parent a075ce160e
commit 7ba5248e56

View File

@ -126,13 +126,15 @@ pub fn get_module_filename(handle HANDLE) ?string {
mut buf := &u16(malloc(4096))
for {
status := C.GetModuleFileName(handle, &buf, sz)
switch status {
case SUCCESS:
_filename := string_from_wide2(buf, sz)
return _filename
default:
// Must handled with GetLastError and converted by FormatMessage
return error('Cannot get file name from handle')
match status {
SUCCESS {
_filename := string_from_wide2(buf, sz)
return _filename
}
else {
// Must handled with GetLastError and converted by FormatMessage
return error('Cannot get file name from handle')
}
}
}
panic('this should be unreachable') // TODO remove unreachable after loop