diff options
| author | Jesse Ezell <[email protected]> | 2014-03-11 12:42:08 -0700 |
|---|---|---|
| committer | Jesse Ezell <[email protected]> | 2014-03-11 12:42:08 -0700 |
| commit | 7cbbeff7ac9fd559f207b0f7aa200f537cc42598 (patch) | |
| tree | a4c6cd33a420630ea0d3cd6a358064cbe6114b9f /walk.go | |
| parent | 5f5906878ebb6db6b1841e42c368f5b69fd7794d (diff) | |
| parent | 1cf81178141c504c62bb3faaa406db665dc5471a (diff) | |
merge with latest
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) } |
