diff options
author | Rob Pike <r@golang.org> | 2009-02-06 17:54:26 -0800 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2009-02-06 17:54:26 -0800 |
commit | af453527aec6688b75e3ae72de78c76920de8569 (patch) | |
tree | 2c4197b8de65fcc683cb84de39fb2de011f08a9f /src/lib/syscall/syscall.go | |
parent | 3669adf2ff20dc664fd2f4d8cf77063d92dbc09a (diff) | |
download | golang-af453527aec6688b75e3ae72de78c76920de8569.tar.gz |
portable stat for os
add name to os.FD
clean up some interfaces
R=rsc
DELTA=318 (231 added, 44 deleted, 43 changed)
OCL=24624
CL=24627
Diffstat (limited to 'src/lib/syscall/syscall.go')
-rw-r--r-- | src/lib/syscall/syscall.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/syscall/syscall.go b/src/lib/syscall/syscall.go index 780f0f262..d8db5ce5d 100644 --- a/src/lib/syscall/syscall.go +++ b/src/lib/syscall/syscall.go @@ -16,13 +16,10 @@ func RawSyscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64); * Used to convert file names to byte arrays for passing to kernel, * but useful elsewhere too. */ -func StringToBytes(b []byte, s string) bool { - if len(s) >= len(b) { - return false - } +func StringBytePtr(s string) *byte { + a := make([]byte, len(s)+1); for i := 0; i < len(s); i++ { - b[i] = s[i] + a[i] = s[i]; } - b[len(s)] = '\000'; // not necessary - memory is zeroed - but be explicit - return true + return &a[0]; } |