vendor: Update github.com/zillode/notify

This commit is contained in:
Jakob Borg 2017-12-10 19:40:16 +01:00
parent ece1defb2f
commit 57eb1710e9
8 changed files with 88 additions and 45 deletions

View File

@ -2,10 +2,52 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// +build !debug
package notify
func dbgprint(...interface{}) {}
import (
"log"
"os"
"runtime"
"strings"
)
func dbgprintf(string, ...interface{}) {}
var dbgprint func(...interface{})
var dbgprintf func(string, ...interface{})
var dbgcallstack func(max int) []string
func init() {
if _, ok := os.LookupEnv("NOTIFY_DEBUG"); ok || debugTag {
log.SetOutput(os.Stdout)
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
dbgprint = func(v ...interface{}) {
v = append([]interface{}{"[D] "}, v...)
log.Println(v...)
}
dbgprintf = func(format string, v ...interface{}) {
format = "[D] " + format
log.Printf(format, v...)
}
dbgcallstack = func(max int) []string {
pc, stack := make([]uintptr, max), make([]string, 0, max)
runtime.Callers(2, pc)
for _, pc := range pc {
if f := runtime.FuncForPC(pc); f != nil {
fname := f.Name()
idx := strings.LastIndex(fname, string(os.PathSeparator))
if idx != -1 {
stack = append(stack, fname[idx+1:])
} else {
stack = append(stack, fname)
}
}
}
return stack
}
return
}
dbgprint = func(v ...interface{}) {}
dbgprintf = func(format string, v ...interface{}) {}
dbgcallstack = func(max int) []string { return nil }
}

View File

@ -6,38 +6,4 @@
package notify
import (
"fmt"
"os"
"runtime"
"strings"
)
func dbgprint(v ...interface{}) {
fmt.Printf("[D] ")
fmt.Print(v...)
fmt.Printf("\n\n")
}
func dbgprintf(format string, v ...interface{}) {
fmt.Printf("[D] ")
fmt.Printf(format, v...)
fmt.Printf("\n\n")
}
func dbgcallstack(max int) []string {
pc, stack := make([]uintptr, max), make([]string, 0, max)
runtime.Callers(2, pc)
for _, pc := range pc {
if f := runtime.FuncForPC(pc); f != nil {
fname := f.Name()
idx := strings.LastIndex(fname, string(os.PathSeparator))
if idx != -1 {
stack = append(stack, fname[idx+1:])
} else {
stack = append(stack, fname)
}
}
}
return stack
}
var debugTag bool = true

9
vendor/github.com/zillode/notify/debug_nodebug.go generated vendored Normal file
View File

@ -0,0 +1,9 @@
// Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// +build !debug
package notify
var debugTag bool = false

View File

@ -6,7 +6,6 @@ package notify
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -71,7 +70,11 @@ Traverse:
case errSkip:
continue Traverse
default:
return fmt.Errorf("error while traversing %q: %v", nd.Name, err)
return &os.PathError{
Op: "error while traversing",
Path: nd.Name,
Err: err,
}
}
// TODO(rjeczalik): tolerate open failures - add failed names to
// AddDirError and notify users which names are not added to the tree.

View File

@ -48,7 +48,7 @@ var wg sync.WaitGroup // used to wait until the runloop starts
// started and is ready via the wg. It also serves purpose of a dummy source,
// thanks to it the runloop does not return as it also has at least one source
// registered.
var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{
var source = C.CFRunLoopSourceCreate(refZero, 0, &C.CFRunLoopSourceContext{
perform: (C.CFRunLoopPerformCallBack)(C.gosource),
})
@ -159,8 +159,8 @@ func (s *stream) Start() error {
return nil
}
wg.Wait()
p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil)
path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
p := C.CFStringCreateWithCStringNoCopy(refZero, C.CString(s.path), C.kCFStringEncodingUTF8, refZero)
path := C.CFArrayCreate(refZero, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil)
ctx := C.FSEventStreamContext{}
ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags)
if ref == nilstream {

View File

@ -0,0 +1,9 @@
// Copyright (c) 2017 The Notify Authors. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// +build darwin,!kqueue,go1.10
package notify
const refZero = 0

View File

@ -0,0 +1,14 @@
// Copyright (c) 2017 The Notify Authors. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// +build darwin,!kqueue,cgo,!go1.10
package notify
/*
#include <CoreServices/CoreServices.h>
*/
import "C"
var refZero = (*C.struct___CFAllocator)(nil)

2
vendor/manifest vendored
View File

@ -449,7 +449,7 @@
"importpath": "github.com/zillode/notify",
"repository": "https://github.com/zillode/notify",
"vcs": "git",
"revision": "54e3093eb7377fd139c4605f475cc78e83610b9d",
"revision": "8fff849a2026ce7a59f67ed9747dd9c7adc8bd0b",
"branch": "master",
"notests": true
},