CopyFrom pattern for DNS and use it for Cookie

This commit is contained in:
soypat
2025-06-25 09:32:35 -03:00
parent 1fcde05284
commit 23212d8dc6
6 changed files with 81 additions and 12 deletions
+2 -2
View File
@@ -46,8 +46,8 @@ func (c *Cookie) ParseBytes(cookie []byte) error {
return c.Parse()
}
// CopyTo makes a copy of the cookie in dst argument. No memory is shared between cookies.
func (c *Cookie) CopyTo(dst *Cookie) {
// CopyFrom makes a copy of the argument cookie to the receiver dst argument. No memory is shared between cookies.
func (dst *Cookie) CopyFrom(c Cookie) {
dst.buf = append(dst.buf[:0], c.buf...)
dst.kvs = append(dst.kvs[:0], c.kvs...)
}