mirror of
https://github.com/vlang/v.git
synced 2025-09-13 09:25:45 -04:00
os: small cleanup in the FreeBSD branch of os.executable/0: use fixed array for the sysctl params, instead of allocating a dynamic one (#20353)
This commit is contained in:
parent
d5dba2d4c6
commit
8359df0a01
@ -716,11 +716,8 @@ pub fn executable() string {
|
|||||||
}
|
}
|
||||||
$if freebsd {
|
$if freebsd {
|
||||||
bufsize := usize(max_path_buffer_size)
|
bufsize := usize(max_path_buffer_size)
|
||||||
mib := [1, // CTL_KERN
|
mib := [C.CTL_KERN, C.KERN_PROC, C.KERN_PROC_PATHNAME, -1]!
|
||||||
14, // KERN_PROC
|
unsafe { C.sysctl(&mib[0], mib.len, &result[0], &bufsize, 0, 0) }
|
||||||
12, // KERN_PROC_PATHNAME
|
|
||||||
-1]
|
|
||||||
unsafe { C.sysctl(mib.data, mib.len, &result[0], &bufsize, 0, 0) }
|
|
||||||
res := unsafe { tos_clone(&result[0]) }
|
res := unsafe { tos_clone(&result[0]) }
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user