add comments

Change-Id: I2e9cea8d39c1d1e9df9ef7e8172060400b596dae
This commit is contained in:
Mateusz Poliwczak 2023-12-27 15:57:51 +01:00
parent 38d219b81f
commit 38f1d6c19d
2 changed files with 8 additions and 3 deletions

View File

@ -112,6 +112,7 @@ func LastIndexRabinKarp[T string | []byte](s, sep T) int {
}
// MakeNoZero makes a slice of length n and capacity of at least n Bytes
// without zeroing the bytes. It is the caller's responsibility to
// ensure uninitialized bytes do not leak to the end user.
// without zeroing the bytes (including the bytes between len and cap).
// It is the caller's responsibility to ensure uninitialized bytes
// do not leak to the end user.
func MakeNoZero(n int) []byte

View File

@ -15,7 +15,11 @@ import (
// Do not copy a non-zero Builder.
type Builder struct {
addr *Builder // of receiver, to detect copies by value
buf []byte
// External users should never get direct access to this buffer, since
// the slice at some point will be converted to a string using unsafe, also
// data between len(buf) and cap(buf) might be uninitialized.
buf []byte
}
// noescape hides a pointer from escape analysis. It is the identity function