windows/mkwinsyscall: use global variable to avoid allocation in errnoErr

Change-Id: I6f089ea96bfbad6390c50a63e9d2fb290cc8654a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264578
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Alex Brainman
2020-10-24 17:55:14 +11:00
parent ef9fd89ba2
commit 9f70ab9862
3 changed files with 6 additions and 3 deletions

View File

@@ -864,6 +864,7 @@ const (
var (
errERROR_IO_PENDING error = {{syscalldot}}Errno(errnoERROR_IO_PENDING)
errERROR_EINVAL error = {{syscalldot}}EINVAL
)
// errnoErr returns common boxed Errno values, to prevent
@@ -871,7 +872,7 @@ var (
func errnoErr(e {{syscalldot}}Errno) error {
switch e {
case 0:
return {{syscalldot}}EINVAL
return errERROR_EINVAL
case errnoERROR_IO_PENDING:
return errERROR_IO_PENDING
}

View File

@@ -19,6 +19,7 @@ const (
var (
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
errERROR_EINVAL error = syscall.EINVAL
)
// errnoErr returns common boxed Errno values, to prevent
@@ -26,7 +27,7 @@ var (
func errnoErr(e syscall.Errno) error {
switch e {
case 0:
return syscall.EINVAL
return errERROR_EINVAL
case errnoERROR_IO_PENDING:
return errERROR_IO_PENDING
}

View File

@@ -17,6 +17,7 @@ const (
var (
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
errERROR_EINVAL error = syscall.EINVAL
)
// errnoErr returns common boxed Errno values, to prevent
@@ -24,7 +25,7 @@ var (
func errnoErr(e syscall.Errno) error {
switch e {
case 0:
return syscall.EINVAL
return errERROR_EINVAL
case errnoERROR_IO_PENDING:
return errERROR_IO_PENDING
}