mirror of
https://github.com/vlang/v.git
synced 2025-09-12 17:07:11 -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 {
|
||||
bufsize := usize(max_path_buffer_size)
|
||||
mib := [1, // CTL_KERN
|
||||
14, // KERN_PROC
|
||||
12, // KERN_PROC_PATHNAME
|
||||
-1]
|
||||
unsafe { C.sysctl(mib.data, mib.len, &result[0], &bufsize, 0, 0) }
|
||||
mib := [C.CTL_KERN, C.KERN_PROC, C.KERN_PROC_PATHNAME, -1]!
|
||||
unsafe { C.sysctl(&mib[0], mib.len, &result[0], &bufsize, 0, 0) }
|
||||
res := unsafe { tos_clone(&result[0]) }
|
||||
return res
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user