// netName returns the name used when referring to a decred network. TestNet3
// correctly returns "testnet3", but not TestNet2. This function may be removed
// after testnet2 is ancient history.
972007
func netName(chainParams *netparams.Params) string {
	// The following switch is to ensure this code is not built for testnet2, as
	// TestNet2 was removed entirely for dcrd 1.3.0. Compile check!
	switch chainParams.Net {
	case wire.TestNet3, wire.MainNet, wire.SimNet:
	default:
		log.Warnf("Unknown network: %s", chainParams.Name)
	}
	return chainParams.Name
}
420548
func (n *NodeDevice) GetName() (string, error) {
	var err C.virError
	name := C.virNodeDeviceGetNameWrapper(n.ptr, &err)
	if name == nil {
		return "", makeError(&err)
	}
	return C.GoString(name), nil
}
570720
func (d *Decoder) nsname() (name Name, ok bool) {
	s, ok := d.name()
	if !ok {
		return
	}
	i := strings.Index(s, ":")
	if i < 0 {
		name.Local = s
	} else {
		name.Space = s[0:i]
		name.Local = s[i+1:]
	}
	return name, true
}
1092464
func Hostname() string {
	hostname := os.Getenv("HOSTNAME")
	if len(hostname) > 0 {
		return hostname
	}
	hostname, err := os.Hostname()
	if err == nil {
		return hostname
	}
	return "localhost"
}
37889
func (s *Service) NewCNAME(name string, target string) *dns.CNAME {
	return &dns.CNAME{Hdr: dns.RR_Header{Name: name, Rrtype: dns.TypeCNAME, Class: dns.ClassINET, Ttl: s.TTL}, Target: dns.Fqdn(target)}
}
467007
func (r Network) GetName() (resp string, err error) {
	err = r.Session.DoRequest("SoftLayer_Network", "getName", nil, &r.Options, &resp)
	return
}
1195833
func (s *XPackSecurityDeleteRoleService) Name(name string) *XPackSecurityDeleteRoleService {
	s.name = name
	return s
}
576687
func networkDir(dataDir string, chainParams *chaincfg.Params) string {
	netname := chainParams.Name

	// For now, we must always name the testnet data directory as "testnet"
	// and not "testnet3" or any other version, as the chaincfg testnet3
	// paramaters will likely be switched to being named "testnet3" in the
	// future.  This is done to future proof that change, and an upgrade
	// plan to move the testnet3 data directory can be worked out later.
	if chainParams.Net == wire.TestNet3 {
		netname = "testnet"
	}

	return filepath.Join(dataDir, netname)
}
498540
func (s *LoadBalancer) SetDNSName(v string) *LoadBalancer {
	s.DNSName = &v
	return s
}
1021759
func (s *NetworkProfile) SetName(v string) *NetworkProfile {
	s.Name = &v
	return s
}
1047559
func (n *Interface) GetName() (string, error) {
	var err C.virError
	result := C.virInterfaceGetNameWrapper(n.ptr, &err)
	if result == nil {
		return "", makeError(&err)
	}
	name := C.GoString(result)
	return name, nil
}
23581
func networkingNetworkV2Name(d *schema.ResourceData, meta interface{}, networkID string) (string, error) {
	config := meta.(*Config)
	networkingClient, err := config.networkingV2Client(GetRegion(d, config))
	if err != nil {
		return "", fmt.Errorf("Error creating OpenStack network client: %s", err)
	}

	opts := networks.ListOpts{ID: networkID}
	pager := networks.List(networkingClient, opts)
	networkName := ""

	err = pager.EachPage(func(page pagination.Page) (bool, error) {
		networkList, err := networks.ExtractNetworks(page)
		if err != nil {
			return false, err
		}

		for _, n := range networkList {
			if n.ID == networkID {
				networkName = n.Name
				return false, nil
			}
		}

		return true, nil
	})

	return networkName, err
}
3069
func (s *FieldSort) FieldName(fieldName string) *FieldSort {
	s.fieldName = fieldName
	return s
}
1052294
func newName(n, ns, ens string) (*name, error) {
	var nn name

	if index := strings.LastIndexByte(n, '.'); index > -1 {
		// inputName does contain a dot, so ignore everything else and use it as the full name
		nn.fullName = n
		nn.namespace = n[:index]
	} else {
		// inputName does not contain a dot, therefore is not the full name
		if ns != nullNamespace {
			// if namespace provided in the schema in the same schema level, use it
			nn.fullName = ns + "." + n
			nn.namespace = ns
		} else if ens != nullNamespace {
			// otherwise if enclosing namespace provided, use it
			nn.fullName = ens + "." + n
			nn.namespace = ens
		} else {
			// otherwise no namespace, so use null namespace, the empty string
			nn.fullName = n
		}
	}

	// verify all components of the full name for adherence to Avro naming rules
	for i, component := range strings.Split(nn.fullName, ".") {
		if i == 0 && RelaxedNameValidation && component == "" {
			continue
		}
		if err := checkNameComponent(component); err != nil {
			return nil, err
		}
	}

	return &nn, nil
}
240202
func (info *nodeInfo) prettyName() string {
	var name string
	if info.address != 0 {
		name = fmt.Sprintf("%016x", info.address)
	}

	if info.name != "" {
		name = name + " " + info.name
	}

	if info.file != "" {
		name += " " + trimPath(info.file)
		if info.lineno != 0 {
			name += fmt.Sprintf(":%d", info.lineno)
		}
	}

	if info.inline {
		name = name + " (inline)"
	}

	if name = strings.TrimSpace(name); name == "" && info.objfile != "" {
		name = "[" + info.objfile + "]"
	}
	return name
}
449122
func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
	cName := C.CString(name)
	defer C.free(unsafe.Pointer(cName))
	var err C.virError
	ptr := C.virNetworkLookupByNameWrapper(c.ptr, cName, &err)
	if ptr == nil {
		return nil, makeError(&err)
	}
	return &Network{ptr: ptr}, nil
}
95589
func (c Common) ObjectName(ctx context.Context) (string, error) {
	var o mo.ManagedEntity

	err := c.Properties(ctx, c.Reference(), []string{"name"}, &o)
	if err != nil {
		return "", err
	}

	if o.Name != "" {
		return o.Name, nil
	}

	// Network has its own "name" field...
	var n mo.Network

	err = c.Properties(ctx, c.Reference(), []string{"name"}, &n)
	if err != nil {
		return "", err
	}

	return n.Name, nil
}