runtime: Remove now unnecessary pad field from ParFor.

It is not needed due to the removal of the ctx field.
    
    Reviewed-on: https://go-review.googlesource.com/16525

From-SVN: r229616
This commit is contained in:
Ian Lance Taylor 2015-10-31 00:59:47 +00:00
parent 725e1be340
commit af146490bb
1007 changed files with 86529 additions and 30520 deletions

View file

@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Read static host/IP entries from /etc/hosts.
package net
import (
@ -13,8 +11,21 @@ import (
const cacheMaxAge = 5 * time.Minute
// hostsPath points to the file with static IP/address entries.
var hostsPath = "/etc/hosts"
func parseLiteralIP(addr string) string {
var ip IP
var zone string
ip = parseIPv4(addr)
if ip == nil {
ip, zone = parseIPv6(addr, true)
}
if ip == nil {
return ""
}
if zone == "" {
return ip.String()
}
return ip.String() + "%" + zone
}
// Simple cache.
var hosts struct {
@ -27,7 +38,7 @@ var hosts struct {
func readHosts() {
now := time.Now()
hp := hostsPath
hp := testHookHostsPath
if len(hosts.byName) == 0 || now.After(hosts.expire) || hosts.path != hp {
hs := make(map[string][]string)
is := make(map[string][]string)
@ -41,13 +52,17 @@ func readHosts() {
line = line[0:i]
}
f := getFields(line)
if len(f) < 2 || ParseIP(f[0]) == nil {
if len(f) < 2 {
continue
}
addr := parseLiteralIP(f[0])
if addr == "" {
continue
}
for i := 1; i < len(f); i++ {
h := f[i]
hs[h] = append(hs[h], f[0])
is[f[0]] = append(is[f[0]], h)
hs[h] = append(hs[h], addr)
is[addr] = append(is[addr], h)
}
}
// Update the data cache.
@ -77,6 +92,10 @@ func lookupStaticAddr(addr string) []string {
hosts.Lock()
defer hosts.Unlock()
readHosts()
addr = parseLiteralIP(addr)
if addr == "" {
return nil
}
if len(hosts.byAddr) != 0 {
if hosts, ok := hosts.byAddr[addr]; ok {
return hosts