diff options
| author | Jesse Ezell <[email protected]> | 2014-03-11 12:29:40 -0700 |
|---|---|---|
| committer | Jesse Ezell <[email protected]> | 2014-03-11 12:29:40 -0700 |
| commit | f1e889928a5804a55712266d09acafd1371aceb3 (patch) | |
| tree | cf30f8ce9fcaec51c3d71ae911a6a8cdaf288d34 /walk.go | |
| parent | e5946d4009cf58f7a041f647e953a454159e2d4f (diff) | |
| parent | 1cf81178141c504c62bb3faaa406db665dc5471a (diff) | |
merge with latest, replace merge wrappers with go code
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) } |
