use correct size

This commit is contained in:
Mateusz Poliwczak 2023-05-08 11:23:05 +02:00
parent 9edfc5093c
commit 73d7f4f8c3
2 changed files with 5 additions and 5 deletions

View File

@ -119,7 +119,7 @@ func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err
func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
type ResState struct {
unexported [70]uintptr
unexported [69]uintptr
}
//go:cgo_import_dynamic libresolv_res_9_ninit res_9_ninit "/usr/lib/libresolv.9.dylib"

View File

@ -17,10 +17,10 @@ import (
)
func init() {
const expected_size = int(unsafe.Sizeof(C.struct___res_state{}))
const got_size = int(unsafe.Sizeof(unix.ResState{}))
const expected_size = unsafe.Sizeof(C.struct___res_state{})
const got_size = unsafe.Sizeof(unix.ResState{})
// This will cause a compile error when the size differs in any way.
var _ [expected_size - got_size]byte
// This will cause a compile error when the size of
// unix.ResState is too small.
var _ [got_size - expected_size]byte
}