func Memcmp(b1, b2 []byte) bool { if len(b1) != len(b2) { return false } if len(b1) == 0 { return true } return C.memcmp(unsafe.Pointer(&b1[0]), unsafe.Pointer(&b2[0]), C.size_t(len(b1))) == 0 }
func test6506() { // nothing to run, just make sure this compiles var x C.size_t C.calloc(x, x) C.malloc(x) C.realloc(nil, x) C.memcpy(nil, nil, x) C.memcmp(nil, nil, x) C.memmove(nil, nil, x) C.strncpy(nil, nil, x) C.strncmp(nil, nil, x) C.strncat(nil, nil, x) x = C.strxfrm(nil, nil, x) C.memchr(nil, 0, x) x = C.strcspn(nil, nil) x = C.strspn(nil, nil) C.memset(nil, 0, x) x = C.strlen(nil) _ = x }
// Compare functions // func CgoMemcmp(to, from []byte) bool { // seriously this can't be a good idea return C.memcmp(unsafe.Pointer(&(to[0])), unsafe.Pointer(&(from[0])), C.size_t(len(to))) == 0 }