mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04:00
go.sys/windows: delete errors_windows.go (except APPLICATION_ERROR) and Errno
All consts in errors_windows.go (except APPLICATION_ERROR) were "invented" at the start of windows port to have minimal impact on existing Go packages. No point keeping them around. Also remove Errno, since we will be using syscall.Errno everywhere anyway. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/128290044
This commit is contained in:
+5
-3
@@ -21,13 +21,15 @@
|
||||
// holds a value of type syscall.Errno.
|
||||
package windows
|
||||
|
||||
import "syscall"
|
||||
|
||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||
// containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, EINVAL).
|
||||
// location, it returns (nil, syscall.EINVAL).
|
||||
func ByteSliceFromString(s string) ([]byte, error) {
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] == 0 {
|
||||
return nil, EINVAL
|
||||
return nil, syscall.EINVAL
|
||||
}
|
||||
}
|
||||
a := make([]byte, len(s)+1)
|
||||
@@ -37,7 +39,7 @@ func ByteSliceFromString(s string) ([]byte, error) {
|
||||
|
||||
// BytePtrFromString returns a pointer to a NUL-terminated array of
|
||||
// bytes containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, EINVAL).
|
||||
// location, it returns (nil, syscall.EINVAL).
|
||||
func BytePtrFromString(s string) (*byte, error) {
|
||||
a, err := ByteSliceFromString(s)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user