net: make zone helpers into methods of ipv6ZoneCache
Change-Id: Id93e78f0c8bef125f124a0a919053208e24a63cd
Reviewed-on: https://go-review.googlesource.com/41836
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/net/interface.go b/src/net/interface.go
index b3297f2..4036a7f 100644
--- a/src/net/interface.go
+++ b/src/net/interface.go
@@ -211,30 +211,30 @@
}
}
-func zoneToString(zone int) string {
- if zone == 0 {
+func (zc *ipv6ZoneCache) name(index int) string {
+ if index == 0 {
return ""
}
zoneCache.update(nil)
zoneCache.RLock()
defer zoneCache.RUnlock()
- name, ok := zoneCache.toName[zone]
+ name, ok := zoneCache.toName[index]
if !ok {
- name = uitoa(uint(zone))
+ name = uitoa(uint(index))
}
return name
}
-func zoneToInt(zone string) int {
- if zone == "" {
+func (zc *ipv6ZoneCache) index(name string) int {
+ if name == "" {
return 0
}
zoneCache.update(nil)
zoneCache.RLock()
defer zoneCache.RUnlock()
- index, ok := zoneCache.toIndex[zone]
+ index, ok := zoneCache.toIndex[name]
if !ok {
- index, _, _ = dtoi(zone)
+ index, _, _ = dtoi(name)
}
return index
}