Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: alloc.go

Issue 1409173004: Remove usage of unsafe from gkvlite (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gkvlite.git@master
Patch Set: get locks out of other lock Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | collection.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: alloc.go
diff --git a/alloc.go b/alloc.go
index 803d75866a135663e3957c0d385092e1adbf11b6..c617a6a6a354e68d8e7d0fb6b4747c0513ed9114 100644
--- a/alloc.go
+++ b/alloc.go
@@ -4,7 +4,6 @@ import (
"fmt"
"sync"
"sync/atomic"
- "unsafe"
)
var freeNodeLock sync.Mutex
@@ -173,8 +172,8 @@ func (t *Collection) mkNodeLoc(n *node) *nodeLoc {
allocStats.CurFreeNodeLocs--
freeNodeLocLock.Unlock()
}
- nloc.loc = unsafe.Pointer(nil)
- nloc.node = unsafe.Pointer(n)
+ nloc.loc = nil
+ nloc.node = n
nloc.next = nil
return nloc
}
@@ -187,8 +186,8 @@ func (t *Collection) freeNodeLoc(nloc *nodeLoc) {
if nloc.next != nil {
panic("double free nodeLoc")
}
- nloc.loc = unsafe.Pointer(nil)
- nloc.node = unsafe.Pointer(nil)
+ nloc.loc = nil
+ nloc.node = nil
freeNodeLocLock.Lock()
nloc.next = freeNodeLocs
« no previous file with comments | « no previous file | collection.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698