1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:34:39 -07:00

cgo: accept null pointers in gccgo flavour of C.GoString.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5569074
This commit is contained in:
Rémy Oudompheng 2012-01-27 09:36:53 +01:00
parent 75397e65ee
commit 21c65e8f33

View File

@ -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) {