Skip to content

Commit

Permalink
Merge pull request #85 from pbnjay/global_uids
Browse files Browse the repository at this point in the history
fix non-pointer uintptr -> uint64, export NextUID
  • Loading branch information
barakmich committed Jul 28, 2014
2 parents 3121169 + a83b7ea commit 0238332
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion graph/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type Iterator interface {
Close()

// UID returns the unique identifier of the iterator.
UID() uintptr
UID() uint64
}

// FixedIterator wraps iterators that are modifiable by addition of fixed value sets.
Expand Down
12 changes: 6 additions & 6 deletions graph/iterator/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
"github.com/google/cayley/graph"
)

var nextIteratorID uintptr
var nextIteratorID uint64

func nextID() uintptr {
return atomic.AddUintptr(&nextIteratorID, 1) - 1
func NextUID() uint64 {
return atomic.AddUint64(&nextIteratorID, 1) - 1
}

// The Base iterator is the iterator other iterators inherit from to get some
Expand All @@ -40,19 +40,19 @@ type Base struct {
tags []string
fixedTags map[string]graph.Value
canNext bool
uid uintptr
uid uint64
}

// Called by subclases.
func BaseInit(it *Base) {
// Your basic iterator is nextable
it.canNext = true
if glog.V(2) {
it.uid = nextID()
it.uid = NextUID()
}
}

func (it *Base) UID() uintptr {
func (it *Base) UID() uint64 {
return it.uid
}

Expand Down

0 comments on commit 0238332

Please sign in to comment.