Merge pull request #348 from MagicalTux/git2go_issue_314

Make New*BackendFromC take unsafe.Pointer as argument
This commit is contained in:
Carlos Martín Nieto 2016-10-31 20:35:54 +01:00 committed by GitHub
commit 0b98f7beae
2 changed files with 5 additions and 4 deletions

4
odb.go
View File

@ -36,8 +36,8 @@ func NewOdb() (odb *Odb, err error) {
return odb, nil
}
func NewOdbBackendFromC(ptr *C.git_odb_backend) (backend *OdbBackend) {
backend = &OdbBackend{ptr}
func NewOdbBackendFromC(ptr unsafe.Pointer) (backend *OdbBackend) {
backend = &OdbBackend{(*C.git_odb_backend)(ptr)}
return backend
}

View File

@ -9,6 +9,7 @@ extern void _go_git_refdb_backend_free(git_refdb_backend *backend);
import "C"
import (
"runtime"
"unsafe"
)
type Refdb struct {
@ -34,8 +35,8 @@ func (v *Repository) NewRefdb() (refdb *Refdb, err error) {
return refdb, nil
}
func NewRefdbBackendFromC(ptr *C.git_refdb_backend) (backend *RefdbBackend) {
backend = &RefdbBackend{ptr}
func NewRefdbBackendFromC(ptr unsafe.Pointer) (backend *RefdbBackend) {
backend = &RefdbBackend{(*C.git_refdb_backend)(ptr)}
return backend
}