aboutsummaryrefslogtreecommitdiffstats
path: root/cshared
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-22 03:29:05 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-22 03:29:05 +0200
commit2ed3474ab8e52c98a87e390d5128d45d693a115d (patch)
tree6f136c2508c22f6b5146ef08c49821a45a5f2357 /cshared
parent5b13c1a2e55cb442484d9c7b45389f422b110eec (diff)
downloadgo-git-2ed3474ab8e52c98a87e390d5128d45d693a115d.tar.gz
ForEach review and Commit.Tree err return
Diffstat (limited to 'cshared')
-rw-r--r--cshared/commit_cshared.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cshared/commit_cshared.go b/cshared/commit_cshared.go
index e73fb4a..8cb91aa 100644
--- a/cshared/commit_cshared.go
+++ b/cshared/commit_cshared.go
@@ -62,7 +62,11 @@ func c_Commit_Tree(c uint64) uint64 {
return IH
}
commit := obj.(*git.Commit)
- tree := commit.Tree()
+ tree, err := commit.Tree()
+ if err != nil {
+ return IH
+ }
+
tree_handle := RegisterObject(tree)
return uint64(tree_handle)
}
@@ -156,14 +160,14 @@ func c_Commit_References(c uint64, path string) (*C.char, int, int, *C.char) {
return nil, 0, ErrorCodeInternal, C.CString(err.Error())
}
handles := make([]uint64, len(refs))
- for i, c := range(refs) {
+ for i, c := range refs {
handles[i] = uint64(RegisterObject(c))
}
size := 8 * len(handles)
dest := C.malloc(C.size_t(size))
header := (*reflect.SliceHeader)(unsafe.Pointer(&handles))
header.Len *= 8
- copy((*[1<<30]byte)(dest)[:], *(*[]byte)(unsafe.Pointer(header)))
+ copy((*[1 << 30]byte)(dest)[:], *(*[]byte)(unsafe.Pointer(header)))
return (*C.char)(dest), size / 8, ErrorCodeSuccess, nil
}