diff options
| author | Jesse Ezell <[email protected]> | 2014-03-11 12:55:57 -0700 |
|---|---|---|
| committer | Jesse Ezell <[email protected]> | 2014-03-11 12:55:57 -0700 |
| commit | 634acbe498e40e617b4aefcce7a82887a455a04e (patch) | |
| tree | 90d4404350d00b7276096080006e280ec308adff /walk.go | |
| parent | 9fb7a746e0103ceff2fd8eb9845e782711a87535 (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) } |
