Skip to content

Commit

Permalink
Change some metainfo.MetaInfo methods to take pointer receivers
Browse files Browse the repository at this point in the history
It's kind of unnecessary to take them by value here, and, slower. Use Rust instead!!
  • Loading branch information
anacrolix committed Jul 23, 2024
1 parent 32c406f commit 2a4bb31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metainfo/metainfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func LoadFromFile(filename string) (*MetaInfo, error) {
return Load(&buf)
}

func (mi MetaInfo) UnmarshalInfo() (info Info, err error) {
func (mi *MetaInfo) UnmarshalInfo() (info Info, err error) {
err = bencode.Unmarshal(mi.InfoBytes, &info)
return
}
Expand All @@ -68,7 +68,7 @@ func (mi *MetaInfo) HashInfoBytes() (infoHash Hash) {
}

// Encode to bencoded form.
func (mi MetaInfo) Write(w io.Writer) error {
func (mi *MetaInfo) Write(w io.Writer) error {
return bencode.NewEncoder(w).Encode(mi)
}

Expand Down

0 comments on commit 2a4bb31

Please sign in to comment.