summaryrefslogtreecommitdiff
path: root/blob.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-04-01 12:13:37 +0200
committerCarlos Martín Nieto <[email protected]>2014-04-01 12:36:44 +0200
commita06f4a030a90129db76e5a741a73bba5b27cda29 (patch)
tree436e57b23c5bdfb36054f843e2fc4e55b66d8aef /blob.go
parent286ff62b14f2471e58ed3dd93df50d2bbd4fc028 (diff)
Adjust to Go tip changes
It does not like breaking aliasing rules, so let's keep a casted pointer for when libgit2 wants that.
Diffstat (limited to 'blob.go')
-rw-r--r--blob.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/blob.go b/blob.go
index 4cee876..4277127 100644
--- a/blob.go
+++ b/blob.go
@@ -20,15 +20,16 @@ import (
type Blob struct {
gitObject
+ cast_ptr *C.git_blob
}
func (v *Blob) Size() int64 {
- return int64(C.git_blob_rawsize(v.ptr))
+ return int64(C.git_blob_rawsize(v.cast_ptr))
}
func (v *Blob) Contents() []byte {
- size := C.int(C.git_blob_rawsize(v.ptr))
- buffer := unsafe.Pointer(C.git_blob_rawcontent(v.ptr))
+ size := C.int(C.git_blob_rawsize(v.cast_ptr))
+ buffer := unsafe.Pointer(C.git_blob_rawcontent(v.cast_ptr))
return C.GoBytes(buffer, size)
}