Merge pull request #189 from michaelharo/copyto

Split Copy into Copy and CopyTo
This commit is contained in:
Miek Gieben 2015-02-25 06:54:54 +00:00
commit c78310fc5e
1 changed files with 5 additions and 1 deletions

6
msg.go
View File

@ -1915,7 +1915,11 @@ func Copy(r RR) RR {
// Copy returns a new *Msg which is a deep-copy of dns.
func (dns *Msg) Copy() *Msg {
r1 := new(Msg)
return dns.CopyTo(new(Msg))
}
// CopyTo copies the contents to the provided message using a deep-copy and returns the copy.
func (dns *Msg) CopyTo(r1 *Msg) *Msg {
r1.MsgHdr = dns.MsgHdr
r1.Compress = dns.Compress