diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-03 15:56:11 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 19:34:32 +1000 |
commit | 0898a7bb57bc399ff016cea06a0ca35d0bf54d6b (patch) | |
tree | bc1a26ea01d493f4661bf8352cf0f1744dbf33ff /vendor | |
parent | fafd5234bd7be6916e00712a3a138bf2ee92e99b (diff) |
refactor
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/tcell_driver.go | 10 | ||||
-rw-r--r-- | vendor/golang.org/x/sys/windows/security_windows.go | 10 | ||||
-rw-r--r-- | vendor/modules.txt | 4 |
3 files changed, 20 insertions, 4 deletions
diff --git a/vendor/github.com/jesseduffield/gocui/tcell_driver.go b/vendor/github.com/jesseduffield/gocui/tcell_driver.go index edfff081e..517f102dd 100644 --- a/vendor/github.com/jesseduffield/gocui/tcell_driver.go +++ b/vendor/github.com/jesseduffield/gocui/tcell_driver.go @@ -5,6 +5,8 @@ package gocui import ( + "sync" + "github.com/gdamore/tcell/v2" ) @@ -21,6 +23,7 @@ type oldStyle struct { // we're using this cache to speed up rendering, because obtaining the tcell style // from the old style is deterministic var cellStyleCache map[oldStyle]tcell.Style = map[oldStyle]tcell.Style{} +var cacheMutex = sync.RWMutex{} // tcellInit initializes tcell screen for use. func tcellInit() error { @@ -43,7 +46,10 @@ func tcellSetCell(x, y int, ch rune, fg, bg Attribute, outputMode OutputMode) { // getTcellStyle creates tcell.Style from Attributes func getTcellStyle(input oldStyle) tcell.Style { - if cachedResult, ok := cellStyleCache[input]; ok { + cacheMutex.RLock() + cachedResult, ok := cellStyleCache[input] + cacheMutex.RUnlock() + if ok { return cachedResult } @@ -59,7 +65,9 @@ func getTcellStyle(input oldStyle) tcell.Style { st = setTcellFontEffectStyle(st, input.bg) } + cacheMutex.Lock() cellStyleCache[input] = st + cacheMutex.Unlock() return st } diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 0e428ecbb..dd683724f 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -1342,7 +1342,15 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() h.Len = sdLen h.Cap = sdLen - dst := make([]byte, sdLen) + const psize = int(unsafe.Sizeof(uintptr(0))) + + var dst []byte + h = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) + alloc := make([]uintptr, (sdLen+psize-1)/psize) + h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data + h.Len = sdLen + h.Cap = sdLen + copy(dst, src) return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0])) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 0671374dd..2bef0e5f6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -149,7 +149,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem github.com/jesseduffield/go-git/v5/utils/merkletrie/index github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame github.com/jesseduffield/go-git/v5/utils/merkletrie/noder -# github.com/jesseduffield/gocui v0.3.1-0.20210402113210-6fd7ef27ce76 +# github.com/jesseduffield/gocui v0.3.1-0.20210403045716-a3be78c4ccf6 ## explicit github.com/jesseduffield/gocui # github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe @@ -235,7 +235,7 @@ golang.org/x/crypto/ssh/knownhosts golang.org/x/net/context golang.org/x/net/internal/socks golang.org/x/net/proxy -# golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 +# golang.org/x/sys v0.0.0-20210402192133-700132347e07 ## explicit golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader |