diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-03-11 03:44:12 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-03-11 03:44:12 +0100 |
| commit | 1cf81178141c504c62bb3faaa406db665dc5471a (patch) | |
| tree | c6d7b520b5788cedf7e6f84b59c629ecfdf51f5d /walk.go | |
| parent | ea909d8518af303a1d88efd46806fb5b941cc2d8 (diff) | |
| parent | 5e163fa2e8281642dbb9dbf6229a9a20387130d2 (diff) | |
Merge pull request #65 from jezell/blob_and_tree_updates
Minor API enhancements
Diffstat (limited to 'walk.go')
| -rw-r--r-- | walk.go | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -14,11 +14,12 @@ import ( // RevWalk type SortType uint + const ( - SortNone SortType = C.GIT_SORT_NONE - SortTopological = C.GIT_SORT_TOPOLOGICAL - SortTime = C.GIT_SORT_TIME - SortReverse = C.GIT_SORT_REVERSE + SortNone SortType = C.GIT_SORT_NONE + SortTopological = C.GIT_SORT_TOPOLOGICAL + SortTime = C.GIT_SORT_TIME + SortReverse = C.GIT_SORT_REVERSE ) type RevWalk struct { @@ -26,6 +27,12 @@ type RevWalk struct { repo *Repository } +func revWalkFromC(repo *Repository, c *C.git_revwalk) *RevWalk { + v := &RevWalk{ptr: c, repo: repo} + runtime.SetFinalizer(v, (*RevWalk).Free) + return v +} + func (v *RevWalk) Reset() { C.git_revwalk_reset(v.ptr) } @@ -92,6 +99,8 @@ func (v *RevWalk) Sorting(sm SortType) { C.git_revwalk_sorting(v.ptr, C.uint(sm)) } -func freeRevWalk(walk *RevWalk) { - C.git_revwalk_free(walk.ptr) +func (v *RevWalk) Free() { + + runtime.SetFinalizer(v, nil) + C.git_revwalk_free(v.ptr) } |
