Skip to content

Commit

Permalink
cgo: accept null pointers in gccgo flavour of C.GoString.
Browse files Browse the repository at this point in the history
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5569074
  • Loading branch information
remyoudompheng committed Jan 27, 2012
1 parent 75397e6 commit 21c65e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cmd/cgo/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,8 @@ const char *CString(struct __go_string s) {
}
struct __go_string GoString(char *p) {
return __go_byte_array_to_string(p, strlen(p));
int len = (p != NULL) ? strlen(p) : 0;
return __go_byte_array_to_string(p, len);
}
struct __go_string GoStringN(char *p, int n) {
Expand Down

0 comments on commit 21c65e8

Please sign in to comment.