Exemple #1
0
func Memchr(s []byte, c byte) int {
	if len(s) == 0 {
		return -1
	}
	s0 := unsafe.Pointer(&s[0])
	p := C.memchr(s0, C.int(c), C.size_t(len(s)))
	if p == nil {
		return -1
	}
	return int(uintptr(p) - uintptr(s0))
}
Exemple #2
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
}