]> go.fuhry.dev Git - fsnotify.git/commitdiff
Events channel of type Event rather than *Event.
authorNathan Youngman <git@nathany.com>
Sun, 22 Jun 2014 03:16:33 +0000 (21:16 -0600)
committerNathan Youngman <git@nathany.com>
Sun, 22 Jun 2014 03:16:33 +0000 (21:16 -0600)
fsnotify_bsd.go
fsnotify_linux.go
fsnotify_windows.go

index 25823ccc9122ff3ed896f0d1dff1db27fcac9926..cdc38e1154171570ce2a54070fc0ba14b80106de 100644 (file)
@@ -33,9 +33,8 @@ const (
        keventWaitTime = 100e6
 )
 
-func newEvent(name string, mask uint32, create bool) *Event {
-       e := new(Event)
-       e.Name = name
+func newEvent(name string, mask uint32, create bool) Event {
+       e := Event{Name: name}
        if create {
                e.Op |= Create
        }
@@ -69,7 +68,7 @@ type Watcher struct {
        externalWatches map[string]bool     // Map of watches added by user of the library.
        ewmut           sync.Mutex          // Protects access to externalWatches.
        Errors          chan error          // Errors are sent on this channel
-       Events          chan *Event         // Events are returned on this channel
+       Events          chan Event          // Events are returned on this channel
        done            chan bool           // Channel for sending a "quit message" to the reader goroutine
        isClosed        bool                // Set to true when Close() is first called
 }
@@ -88,7 +87,7 @@ func NewWatcher() (*Watcher, error) {
                finfo:           make(map[int]os.FileInfo),
                fileExists:      make(map[string]bool),
                externalWatches: make(map[string]bool),
-               Events:          make(chan *Event),
+               Events:          make(chan Event),
                Errors:          make(chan error),
                done:            make(chan bool, 1),
        }
index 72b1ee1dd26f9736e63370643c846977d5e0651b..591b055dba1e92b3f3e273ce7c338eaea7baeca2 100644 (file)
@@ -20,8 +20,8 @@ const (
                syscall.IN_MOVE_SELF | syscall.IN_DELETE | syscall.IN_DELETE_SELF
 )
 
-func newEvent(name string, mask uint32) *Event {
-       e := &Event{Name: name}
+func newEvent(name string, mask uint32) Event {
+       e := Event{Name: name}
        if mask&syscall.IN_CREATE == syscall.IN_CREATE || mask&syscall.IN_MOVED_TO == syscall.IN_MOVED_TO {
                e.Op |= Create
        }
@@ -51,7 +51,7 @@ type Watcher struct {
        watches  map[string]*watch // Map of inotify watches (key: path)
        paths    map[int]string    // Map of watched paths (key: watch descriptor)
        Errors   chan error        // Errors are sent on this channel
-       Events   chan *Event       // Events are returned on this channel
+       Events   chan Event        // Events are returned on this channel
        done     chan bool         // Channel for sending a "quit message" to the reader goroutine
        isClosed bool              // Set to true when Close() is first called
 }
@@ -66,7 +66,7 @@ func NewWatcher() (*Watcher, error) {
                fd:      fd,
                watches: make(map[string]*watch),
                paths:   make(map[int]string),
-               Events:  make(chan *Event),
+               Events:  make(chan Event),
                Errors:  make(chan error),
                done:    make(chan bool, 1),
        }
index 96992170e32b51d2ec61f930d377d89188faddf2..d0c7e25bcf3726d9a35734f523897aaa2cbe69ca 100644 (file)
@@ -39,8 +39,8 @@ const (
        sys_FS_Q_OVERFLOW = 0x4000
 )
 
-func newEvent(name string, mask uint32) *Event {
-       e := &Event{Name: name}
+func newEvent(name string, mask uint32) Event {
+       e := Event{Name: name}
        if mask&sys_FS_CREATE == sys_FS_CREATE {
                e.Op |= Create
        }
@@ -101,7 +101,7 @@ type Watcher struct {
        port     syscall.Handle // Handle to completion port
        watches  watchMap       // Map of watches (key: i-number)
        input    chan *input    // Inputs to the reader are sent on this channel
-       Events   chan *Event    // Events are returned on this channel
+       Events   chan Event     // Events are returned on this channel
        Errors   chan error     // Errors are sent on this channel
        isClosed bool           // Set to true when Close() is first called
        quit     chan chan<- error
@@ -117,7 +117,7 @@ func NewWatcher() (*Watcher, error) {
                port:    port,
                watches: make(watchMap),
                input:   make(chan *input, 1),
-               Events:  make(chan *Event, 50),
+               Events:  make(chan Event, 50),
                Errors:  make(chan error),
                quit:    make(chan chan<- error, 1),
        }