Skip to content

Commit

Permalink
carddav: pass pointer in CreateAddressBook
Browse files Browse the repository at this point in the history
The struct is a bit too large to pass by value.
  • Loading branch information
emersion committed Feb 7, 2024
1 parent f1d56f2 commit fbcd08d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion carddav/carddav_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (b *testBackend) GetAddressBook(ctx context.Context, path string) (*Address
return nil, webdav.NewHTTPError(404, fmt.Errorf("Not found"))
}

func (*testBackend) CreateAddressBook(ctx context.Context, ab AddressBook) error {
func (*testBackend) CreateAddressBook(ctx context.Context, ab *AddressBook) error {
panic("TODO: implement")
}

Expand Down
4 changes: 2 additions & 2 deletions carddav/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Backend interface {
AddressBookHomeSetPath(ctx context.Context) (string, error)
ListAddressBooks(ctx context.Context) ([]AddressBook, error)
GetAddressBook(ctx context.Context, path string) (*AddressBook, error)
CreateAddressBook(ctx context.Context, addressBook AddressBook) error
CreateAddressBook(ctx context.Context, addressBook *AddressBook) error
DeleteAddressBook(ctx context.Context, path string) error
GetAddressObject(ctx context.Context, path string, req *AddressDataRequest) (*AddressObject, error)
ListAddressObjects(ctx context.Context, path string, req *AddressDataRequest) ([]AddressObject, error)
Expand Down Expand Up @@ -716,7 +716,7 @@ func (b *backend) Mkcol(r *http.Request) error {
// TODO ...
}

return b.Backend.CreateAddressBook(r.Context(), ab)
return b.Backend.CreateAddressBook(r.Context(), &ab)
}

func (b *backend) Copy(r *http.Request, dest *internal.Href, recursive, overwrite bool) (created bool, err error) {
Expand Down

0 comments on commit fbcd08d

Please sign in to comment.