diff options
| author | Vicent Martà <[email protected]> | 2013-06-13 10:15:36 -0700 |
|---|---|---|
| committer | Vicent Martà <[email protected]> | 2013-06-13 10:15:36 -0700 |
| commit | 62f65d071d0671fb53aaca54a2d59a636267c2b0 (patch) | |
| tree | e03dd9af8fb0e7287abfc0597c1a325013ee0073 /blob.go | |
| parent | 01d1a5c5d5fede6f054e50a1154ff747e3879cf8 (diff) | |
| parent | 5766c4accf913bb4a98189177261e1db939397e2 (diff) | |
Merge pull request #13 from libgit2/polymorphism-take-2
My take on polymorphism
Diffstat (limited to 'blob.go')
| -rw-r--r-- | blob.go | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -7,24 +7,18 @@ package git */ import "C" import ( - "runtime" "unsafe" ) type Blob struct { - ptr *C.git_object + gitObject } -func (v *Blob) Free() { - runtime.SetFinalizer(v, nil) - C.git_object_free(v.ptr) -} - -func (v *Blob) Size() int64 { +func (v Blob) Size() int64 { return int64(C.git_blob_rawsize(v.ptr)) } -func (v *Blob) Contents() []byte { +func (v Blob) Contents() []byte { size := C.int(C.git_blob_rawsize(v.ptr)) buffer := unsafe.Pointer(C.git_blob_rawcontent(v.ptr)) return C.GoBytes(buffer, size) |
