Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Delta Between Two Patch Sets: src/pkg/syscall/syscall.go

Issue 4151043: code review 4151043: syscall: do not use NULL for zero-length read, write (Closed)
Left Patch Set: Created 14 years, 1 month ago
Right Patch Set: diff -r f4d6108bf10b https://go.googlecode.com/hg Created 14 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/syscall/mksyscall.sh ('k') | src/pkg/syscall/zsyscall_darwin_386.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This package contains an interface to the low-level operating system 5 // This package contains an interface to the low-level operating system
6 // primitives. The details vary depending on the underlying system. 6 // primitives. The details vary depending on the underlying system.
7 // Its primary use is inside other packages that provide a more portable 7 // Its primary use is inside other packages that provide a more portable
8 // interface to the system, such as "os", "time" and "net". Use those 8 // interface to the system, such as "os", "time" and "net". Use those
9 // packages rather than this one if you can. 9 // packages rather than this one if you can.
10 // For details of the functions and data types in this package consult 10 // For details of the functions and data types in this package consult
11 // the manuals for the appropriate operating system. 11 // the manuals for the appropriate operating system.
12 // These calls return errno == 0 to indicate success; otherwise 12 // These calls return errno == 0 to indicate success; otherwise
13 // errno is an operating system error number describing the failure. 13 // errno is an operating system error number describing the failure.
14 package syscall 14 package syscall
15 15
16 // StringByteSlice returns a NUL-terminated slice of bytes 16 // StringByteSlice returns a NUL-terminated slice of bytes
17 // containing the text of s. 17 // containing the text of s.
18 func StringByteSlice(s string) []byte { 18 func StringByteSlice(s string) []byte {
19 a := make([]byte, len(s)+1) 19 a := make([]byte, len(s)+1)
20 copy(a, s) 20 copy(a, s)
21 return a 21 return a
22 } 22 }
23 23
24 // StringBytePtr returns a pointer to a NUL-terminated array of bytes 24 // StringBytePtr returns a pointer to a NUL-terminated array of bytes
25 // containing the text of s. 25 // containing the text of s.
26 func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] } 26 func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] }
27
28 // Single-word zero for use when we need a valid pointer to 0 bytes.
29 // See mksyscall.sh.
30 var _zero uintptr
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b