// clonePubArg is used when the split buffer scenario has the pubArg in the existing read buffer, but
// we need to hold onto it into the next read.
966255
func (c *client) clonePubArg() {
	// Just copy and re-process original arg buffer.
	c.argBuf = c.scratch[:0]
	c.argBuf = append(c.argBuf, c.pa.arg...)

	// This is a routed msg
	if c.pa.account != nil {
		c.processRoutedMsgArgs(false, c.argBuf)
	} else {
		c.processPub(false, c.argBuf)
	}
}
1285259
func UnmarshalBuffer(bufferPtr *C.buffer_t) []byte {
	length := int(bufferPtr.len)
	buffer := make([]byte, length)
	copy(buffer, (*[1 << 30]byte)(bufferPtr.data)[:length:length])
	return buffer
}
671790
func (buf *IntBuffer) Clone() Buffer {
	if buf == nil {
		return nil
	}
	newB := &IntBuffer{}
	newB.Data = make([]int, len(buf.Data))
	copy(newB.Data, buf.Data)
	newB.Format = &Format{
		NumChannels: buf.Format.NumChannels,
		SampleRate:  buf.Format.SampleRate,
	}
	return newB
}
263494
func (cf *concatFunction) Clone() AggregationFunction {
	nf := *cf
	for i, arg := range cf.Args {
		nf.Args[i] = arg.Clone()
	}
	nf.resultMapper = make(aggCtxMapper)
	return &nf
}
703020
func copyBuf(w io.Writer, r io.Reader) (int64, error) {
	buf := buffer32KPool.Get().([]byte)
	written, err := io.CopyBuffer(w, r, buf)
	buffer32KPool.Put(buf)
	return written, err
}
622622
func mutateTriggersList(blob *[]byte, cb func(*[]*internal.Trigger)) error {
	list, err := unmarshalTriggersList(*blob)
	if err != nil {
		return err
	}
	cb(&list)
	*blob = marshalTriggersList(list)
	return nil
}
137422
func (p *Tagger) Clone() *Tagger {
	return &Tagger{
		Model:  p.Model,
		corpus: p.corpus,

		Output: make(chan lingo.AnnotatedSentence),

		sentences: make(chan lingo.AnnotatedSentence),

		Lemmatizer: p.Lemmatizer,
		Stemmer:    p.Stemmer,
		clusters:   p.clusters,
	}
}
443177
func (ps *PubSub) TryPub(msg interface{}, topics ...string) {
	ps.cmdChan <- cmd{op: tryPub, topics: topics, msg: msg}
}
974400
func cloneURL(src *url.URL) *url.URL {
	dst := &url.URL{}
	*dst = *src

	return dst
}
304426
func Clone(src []byte) []byte {
	clone := make([]byte, len(src))
	copy(clone, src)

	return clone
}
664247
func (rulesMap RulesMap) Clone() RulesMap {
	rulesMapCopy := make(RulesMap)

	for eventName, rules := range rulesMap {
		rulesMapCopy[eventName] = rules.Clone()
	}

	return rulesMapCopy
}
295293
func luaListClone(L *lua.LState) int {
	p := checkLuaList(L, 1)
	if L.GetTop() != 1 {
		L.ArgError(1, "only one argument expected for list#clone method")
		return 0
	}

	newList := &LuaList{l: make([]interface{}, len(p.l))}
	copy(newList.l, p.l)

	ud := L.NewUserData()
	ud.Value = newList
	L.SetMetatable(ud, L.GetTypeMetatable(luaLuaListTypeName))
	L.Push(ud)
	return 1
}
441166
func (b *BuildArgs) Clone() *BuildArgs {
	result := NewBuildArgs(b.argsFromOptions)
	for k, v := range b.allowedBuildArgs {
		result.allowedBuildArgs[k] = v
	}
	for k, v := range b.allowedMetaArgs {
		result.allowedMetaArgs[k] = v
	}
	for k := range b.referencedArgs {
		result.referencedArgs[k] = struct{}{}
	}
	return result
}
870108
func (buf *Float32Buffer) Clone() Buffer {
	if buf == nil {
		return nil
	}
	newB := &Float32Buffer{}
	newB.Data = make([]float32, len(buf.Data))
	copy(newB.Data, buf.Data)
	newB.Format = &Format{
		NumChannels: buf.Format.NumChannels,
		SampleRate:  buf.Format.SampleRate,
	}
	return newB
}
182962
func (p *GenParameters) CloneWithSeed(seed int64) *GenParameters {
	return &GenParameters{
		MinSize:        p.MinSize,
		MaxSize:        p.MaxSize,
		MaxShrinkCount: p.MaxShrinkCount,
		Rng:            rand.New(NewLockedSource(seed)),
	}
}
508216
func (ub *URLBuilder) cloneRoute(name string) clonedRoute {
	route := new(mux.Route)
	root := new(url.URL)

	*route = *ub.router.GetRoute(name) // clone the route
	*root = *ub.root

	return clonedRoute{Route: route, root: root, relative: ub.relative}
}
1324219
func (pm partitionMap) clone() partitionMap {
	// Make deep copy of map.
	pmap := make(partitionMap, len(pm))
	for ns := range pm {
		pmap[ns] = pm[ns].clone()
	}
	return pmap
}