Store pointer to apply options instead of copying the struct

This commit is contained in:
Michael Boulton 2020-08-17 08:17:58 +01:00
parent d8f155f971
commit fff6c9d8ae
No known key found for this signature in database
GPG Key ID: 8A62CA0BE2E0197E
1 changed files with 3 additions and 3 deletions

View File

@ -865,7 +865,7 @@ type ApplyOptions struct {
//export hunkApplyCallback
func hunkApplyCallback(_hunk *C.git_diff_hunk, _payload unsafe.Pointer) C.int {
opts, ok := pointerHandles.Get(_payload).(ApplyOptions)
opts, ok := pointerHandles.Get(_payload).(*ApplyOptions)
if !ok {
panic("invalid apply options payload")
}
@ -888,7 +888,7 @@ func hunkApplyCallback(_hunk *C.git_diff_hunk, _payload unsafe.Pointer) C.int {
//export deltaApplyCallback
func deltaApplyCallback(_delta *C.git_diff_delta, _payload unsafe.Pointer) C.int {
opts, ok := pointerHandles.Get(_payload).(ApplyOptions)
opts, ok := pointerHandles.Get(_payload).(*ApplyOptions)
if !ok {
panic("invalid apply options payload")
}
@ -929,7 +929,7 @@ func (a *ApplyOptions) toC() *C.git_apply_options {
if a.ApplyDeltaCallback != nil || a.ApplyHunkCallback != nil {
C._go_git_populate_apply_cb(opts)
opts.payload = pointerHandles.Track(*a)
opts.payload = pointerHandles.Track(a)
}
return opts