Unverified Commit 906b2fb5 authored by Steven Allen's avatar Steven Allen Committed by GitHub

fix: avoid allocating cids (#348)

parent a8af17a5
......@@ -18,7 +18,8 @@ func (c Cid) Marshal() ([]byte, error) {
}
func (c *Cid) MarshalTo(data []byte) (int, error) {
return copy(data[:c.Size()], c.Cid.Bytes()), nil
// intentionally using KeyString here to avoid allocating.
return copy(data[:c.Size()], c.Cid.KeyString()), nil
}
func (c *Cid) Unmarshal(data []byte) (err error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment