slice: add Clean microfunction
To be used for various cleaning purposes, one line is better than three lines.
This commit is contained in:
parent
58dc8d0c9b
commit
74bf4a8e3f
2 changed files with 15 additions and 0 deletions
|
@ -28,3 +28,10 @@ func Copy(b []byte) []byte {
|
|||
copy(d, b)
|
||||
return d
|
||||
}
|
||||
|
||||
// Clean wipes the data in b by filling it with zeros.
|
||||
func Clean(b []byte) {
|
||||
for i := range b {
|
||||
b[i] = 0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue