// Clone returns a copy of this node.
179630
func (n *NodeInfo) Clone() *NodeInfo {
	clone := &NodeInfo{
		node:                    n.node,
		requestedResource:       n.requestedResource.Clone(),
		nonzeroRequest:          n.nonzeroRequest.Clone(),
		allocatableResource:     n.allocatableResource.Clone(),
		taintsErr:               n.taintsErr,
		TransientInfo:           n.TransientInfo,
		memoryPressureCondition: n.memoryPressureCondition,
		diskPressureCondition:   n.diskPressureCondition,
		pidPressureCondition:    n.pidPressureCondition,
		usedPorts:               make(HostPortInfo),
		imageStates:             n.imageStates,
		generation:              n.generation,
	}
	if len(n.pods) > 0 {
		clone.pods = append([]*v1.Pod(nil), n.pods...)
	}
	if len(n.usedPorts) > 0 {
		// HostPortInfo is a map-in-map struct
		// make sure it's deep copied
		for ip, portMap := range n.usedPorts {
			clone.usedPorts[ip] = make(map[ProtocolPort]struct{})
			for protocolPort, v := range portMap {
				clone.usedPorts[ip][protocolPort] = v
			}
		}
	}
	if len(n.podsWithAffinity) > 0 {
		clone.podsWithAffinity = append([]*v1.Pod(nil), n.podsWithAffinity...)
	}
	if len(n.taints) > 0 {
		clone.taints = append([]v1.Taint(nil), n.taints...)
	}
	return clone
}
1005554
func Clone(b []byte) []byte {
	if b == nil {
		return nil
	}
	buf := make([]byte, len(b))
	copy(buf, b)
	return buf
}
569647
func (b *Backend) Clone() *Backend {
	var c Backend
	c.Copy(b)
	return &c
}
862211
func (c *CheckState) Clone() *CheckState {
	c2 := new(CheckState)
	*c2 = *c
	return c2
}
180935
func (db *DB) Clone() *DB {
	db2 := &DB{
		driverName:  db.driverName,
		sqlDB:       db.sqlDB,
		FieldMapper: db.FieldMapper,
		PerfFunc:    db.PerfFunc,
		LogFunc:     db.LogFunc,
	}
	db2.Builder = db2.newBuilder(db.sqlDB)
	return db2
}
826760
func (trie *Trie) Clone() *Trie {
	return &Trie{
		prefix:                   append(Prefix(nil), trie.prefix...),
		item:                     trie.item,
		maxPrefixPerNode:         trie.maxPrefixPerNode,
		maxChildrenPerSparseNode: trie.maxChildrenPerSparseNode,
		children:                 trie.children.clone(),
	}
}
1266745
func (t *Tree) Copy() *Tree {
	if t == nil {
		return nil
	}
	return &Tree{
		Name: t.Name,
		Root: t.Root.CopyList(),
		text: t.text,
	}
}
1158455
func (*TemplateProvider) Clone(d *deps.Deps) error {

	t := d.Tmpl.(*templateHandler)
	clone := t.clone(d)

	d.Tmpl = clone

	return clone.MarkReady()

}
668694
func (p *Peer) clone() *Peer {
	p.Lock()
	defer p.Unlock()
	return &Peer{
		Name:             p.Name,
		ConnectionString: p.ConnectionString,
		prevLogIndex:     p.prevLogIndex,
		lastActivity:     p.lastActivity,
	}
}
658451
func (v *Values) Clone() *Values {
	v.lock.RLock()
	defer v.lock.RUnlock()

	return newValues(v.root)
}
1180441
func clone(astPtr *Node) {
	node := *astPtr
	if node == nil {
		return
	}

	switch node := node.(type) {
	case *Apply:
		r := new(Apply)
		*astPtr = r
		*r = *node
		clone(&r.Target)
		r.Arguments.Positional = append(make(Nodes, 0), r.Arguments.Positional...)
		for i := range r.Arguments.Positional {
			clone(&r.Arguments.Positional[i])
		}
		r.Arguments.Named = append(make([]NamedArgument, 0), r.Arguments.Named...)
		for i := range r.Arguments.Named {
			clone(&r.Arguments.Named[i].Arg)
		}

	case *ApplyBrace:
		r := new(ApplyBrace)
		*astPtr = r
		*r = *node
		clone(&r.Left)
		clone(&r.Right)

	case *Array:
		r := new(Array)
		*astPtr = r
		*r = *node
		r.Elements = append(make(Nodes, 0), r.Elements...)
		for i := range r.Elements {
			clone(&r.Elements[i])
		}

	case *ArrayComp:
		r := new(ArrayComp)
		*astPtr = r
		*r = *node
		clone(&r.Body)
		cloneForSpec(&r.Spec)

	case *Assert:
		r := new(Assert)
		*astPtr = r
		*r = *node
		clone(&r.Cond)
		clone(&r.Message)
		clone(&r.Rest)

	case *Binary:
		r := new(Binary)
		*astPtr = r
		*r = *node
		clone(&r.Left)
		clone(&r.Right)

	case *Conditional:
		r := new(Conditional)
		*astPtr = r
		*r = *node
		clone(&r.Cond)
		clone(&r.BranchTrue)
		clone(&r.BranchFalse)

	case *Dollar:
		r := new(Dollar)
		*astPtr = r
		*r = *node

	case *Error:
		r := new(Error)
		*astPtr = r
		*r = *node
		clone(&r.Expr)

	case *Function:
		r := new(Function)
		*astPtr = r
		*r = *node
		cloneParameters(&r.Parameters)
		clone(&r.Body)

	case *Import:
		r := new(Import)
		*astPtr = r
		*r = *node
		r.File = new(LiteralString)
		*r.File = *node.File

	case *ImportStr:
		r := new(ImportStr)
		*astPtr = r
		*r = *node
		r.File = new(LiteralString)
		*r.File = *node.File

	case *Index:
		r := new(Index)
		*astPtr = r
		*r = *node
		clone(&r.Target)
		clone(&r.Index)

	case *Slice:
		r := new(Slice)
		*astPtr = r
		*r = *node
		clone(&r.Target)
		clone(&r.BeginIndex)
		clone(&r.EndIndex)
		clone(&r.Step)

	case *Local:
		r := new(Local)
		*astPtr = r
		*r = *node
		r.Binds = append(make(LocalBinds, 0), r.Binds...)
		for i := range r.Binds {
			if r.Binds[i].Fun != nil {
				r.Binds[i].Fun = Clone(r.Binds[i].Fun).(*Function)
			}
			clone(&r.Binds[i].Body)
		}
		clone(&r.Body)

	case *LiteralBoolean:
		r := new(LiteralBoolean)
		*astPtr = r
		*r = *node

	case *LiteralNull:
		r := new(LiteralNull)
		*astPtr = r
		*r = *node

	case *LiteralNumber:
		r := new(LiteralNumber)
		*astPtr = r
		*r = *node

	case *LiteralString:
		r := new(LiteralString)
		*astPtr = r
		*r = *node

	case *Object:
		r := new(Object)
		*astPtr = r
		*r = *node
		r.Fields = append(make(ObjectFields, 0), r.Fields...)
		for i := range r.Fields {
			cloneField(&r.Fields[i])
		}

	case *DesugaredObject:
		r := new(DesugaredObject)
		*astPtr = r
		*r = *node
		r.Fields = append(make(DesugaredObjectFields, 0), r.Fields...)
		for i := range r.Fields {
			cloneDesugaredField(&r.Fields[i])
		}

	case *ObjectComp:
		r := new(ObjectComp)
		*astPtr = r
		*r = *node
		r.Fields = append(make(ObjectFields, 0), r.Fields...)
		for i := range r.Fields {
			cloneField(&r.Fields[i])
		}
		cloneForSpec(&r.Spec)

	case *Parens:
		r := new(Parens)
		*astPtr = r
		*r = *node
		clone(&r.Inner)

	case *Self:
		r := new(Self)
		*astPtr = r
		*r = *node

	case *SuperIndex:
		r := new(SuperIndex)
		*astPtr = r
		*r = *node
		clone(&r.Index)

	case *InSuper:
		r := new(InSuper)
		*astPtr = r
		*r = *node
		clone(&r.Index)

	case *Unary:
		r := new(Unary)
		*astPtr = r
		*r = *node
		clone(&r.Expr)

	case *Var:
		r := new(Var)
		*astPtr = r
		*r = *node

	default:
		panic(fmt.Sprintf("ast.Clone() does not recognize ast: %s", reflect.TypeOf(node)))
	}

	cloneNodeBase(*astPtr)
}
676996
func (n *Node) Copy() node.Node {
	links := make([]*node.Link, len(n.links))
	copy(links, n.links)

	raw := make([]byte, len(n.raw))
	copy(raw, n.raw)

	tree := make([]string, len(n.tree))
	copy(tree, n.tree)

	return &Node{
		obj:   copyObj(n.obj),
		links: links,
		raw:   raw,
		tree:  tree,
		cid:   n.cid,
	}
}
808729
func (n *Node) Copy(c *Node) {
	n.State = c.State
	n.Priority = c.Priority
	n.Host.Copy(&c.Host)
	n.VserversEnabled = c.VserversEnabled
}
108861
func (this *Response) Clone() *Response {
	r := createResponse(this.Response, this.next, this.app)
	r.SetRequest(this.req)
	return r
}
13994
func (c Collector) Clone() Collector {
	col := make(Collector)
	col.Copy(c)
	return col
}
912474
func (k *Kerl) Clone() SpongeFunction {
	clone := NewKerl().(*Kerl)

	clone.s = keccak.CloneState(k.s)
	return clone
}
877120
func (d *D) Clone() *D {
	return &D{
		Values:   d.Values.Clone(),
		hijacker: d.hijacker,
		goodFunc: d.goodFunc,
	}
}