// Merge merges two advertise addrs configs together.
326211
func (a *AdvertiseAddrs) Merge(b *AdvertiseAddrs) *AdvertiseAddrs {
	result := *a

	if b.RPC != "" {
		result.RPC = b.RPC
	}
	if b.Serf != "" {
		result.Serf = b.Serf
	}
	if b.HTTP != "" {
		result.HTTP = b.HTTP
	}
	return &result
}
881579
func (e MapElement) Merge(v Strategy) (Result, error) {
	return v.MergeMap(e)
}
683620
func (c ConfigPolicyNode) Merge(n ctree.Node) ctree.Node {
	// Because Add only allows the ConfigPolicyNode type we
	// are safe to convert ctree.Node interface to ConfigPolicyNode
	cd := n.(*ConfigPolicyNode)
	// For the rules in the passed ConfigPolicyNode(converted) add each rule to
	// this ConfigPolicyNode overwriting where needed.
	no := NewPolicyNode()
	for _, r := range c.rules {
		no.Add(r)
	}

	for _, r := range cd.rules {

		no.Add(r)
	}
	// Return modified version of ConfigPolicyNode(as ctree.Node)
	return no
}
287607
func (c ConversionFuncs) Merge(other ConversionFuncs) ConversionFuncs {
	merged := NewConversionFuncs()
	for k, v := range c.fns {
		merged.fns[k] = v
	}
	for k, v := range other.fns {
		merged.fns[k] = v
	}
	return merged
}
638456
func (s *Storage) Merge(ctx context.Context,
	convID chat1.ConversationID, uid gregor1.UID, msgs []chat1.MessageUnboxed) (res MergeResult, err Error) {
	defer s.Trace(ctx, func() error { return err }, "Merge")()
	return s.MergeHelper(ctx, convID, uid, msgs, nil)
}
1253376
func (c1 *Config) Merge(c2 *Config) *Config {
	var result Config
	result.Providers = make(map[string]string)
	result.Provisioners = make(map[string]string)
	for k, v := range c1.Providers {
		result.Providers[k] = v
	}
	for k, v := range c2.Providers {
		if v1, ok := c1.Providers[k]; ok {
			log.Printf("[INFO] Local %s provider configuration '%s' overrides '%s'", k, v, v1)
		}
		result.Providers[k] = v
	}
	for k, v := range c1.Provisioners {
		result.Provisioners[k] = v
	}
	for k, v := range c2.Provisioners {
		if v1, ok := c1.Provisioners[k]; ok {
			log.Printf("[INFO] Local %s provisioner configuration '%s' overrides '%s'", k, v, v1)
		}
		result.Provisioners[k] = v
	}
	result.DisableCheckpoint = c1.DisableCheckpoint || c2.DisableCheckpoint
	result.DisableCheckpointSignature = c1.DisableCheckpointSignature || c2.DisableCheckpointSignature

	result.PluginCacheDir = c1.PluginCacheDir
	if result.PluginCacheDir == "" {
		result.PluginCacheDir = c2.PluginCacheDir
	}

	if (len(c1.Hosts) + len(c2.Hosts)) > 0 {
		result.Hosts = make(map[string]*ConfigHost)
		for name, host := range c1.Hosts {
			result.Hosts[name] = host
		}
		for name, host := range c2.Hosts {
			result.Hosts[name] = host
		}
	}

	if (len(c1.Credentials) + len(c2.Credentials)) > 0 {
		result.Credentials = make(map[string]map[string]interface{})
		for host, creds := range c1.Credentials {
			result.Credentials[host] = creds
		}
		for host, creds := range c2.Credentials {
			// We just clobber an entry from the other file right now. Will
			// improve on this later using the more-robust merging behavior
			// built in to HCL2.
			result.Credentials[host] = creds
		}
	}

	if (len(c1.CredentialsHelpers) + len(c2.CredentialsHelpers)) > 0 {
		result.CredentialsHelpers = make(map[string]*ConfigCredentialsHelper)
		for name, helper := range c1.CredentialsHelpers {
			result.CredentialsHelpers[name] = helper
		}
		for name, helper := range c2.CredentialsHelpers {
			result.CredentialsHelpers[name] = helper
		}
	}

	return &result
}
226212
func (c Config) Merge(cfg []Config) (config Config) {

	if len(cfg) > 0 {
		config = cfg[0]
		mergo.Merge(&config, c)
	} else {
		_default := c
		config = _default
	}

	return
}
1132668
func (m *MockAccessRequester) Merge(arg0 fosite.Requester) {
	m.ctrl.Call(m, "Merge", arg0)
}
743978
func (m *Minhash) Merge(o *Minhash) {
	if m.seed != o.seed {
		panic("Cannot merge Minhash with different seed")
	}
	m.mw.Merge(o.mw)
}
843892
func (x ContainerConfig) Merge(y ContainerConfig) ContainerConfig {
	x.TTY = x.TTY || y.TTY
	x.Stdin = x.Stdin || y.Stdin
	x.Data = x.Data || y.Data
	if y.Args != nil {
		x.Args = y.Args
	}
	env := make(map[string]string, len(x.Env)+len(y.Env))
	for k, v := range x.Env {
		env[k] = v
	}
	for k, v := range y.Env {
		env[k] = v
	}
	x.Env = env
	mounts := make([]Mount, 0, len(x.Mounts)+len(y.Mounts))
	mounts = append(mounts, x.Mounts...)
	mounts = append(mounts, y.Mounts...)
	x.Mounts = mounts
	volumes := make([]VolumeBinding, 0, len(x.Volumes)+len(y.Volumes))
	volumes = append(volumes, x.Volumes...)
	volumes = append(volumes, y.Volumes...)
	x.Volumes = volumes
	ports := make([]Port, 0, len(x.Ports)+len(y.Ports))
	ports = append(ports, x.Ports...)
	ports = append(ports, y.Ports...)
	x.Ports = ports
	if y.WorkingDir != "" {
		x.WorkingDir = y.WorkingDir
	}
	if y.Uid != nil {
		x.Uid = y.Uid
	}
	if y.Gid != nil {
		x.Gid = y.Gid
	}
	x.HostNetwork = x.HostNetwork || y.HostNetwork
	x.HostPIDNamespace = x.HostPIDNamespace || y.HostPIDNamespace
	return x
}
334485
func (a *segment) Merge(key, val []byte) error {
	return a.mutate(OperationMerge, key, val)
}
1347972
func (l LDFlags) Merge(r LDFlags) {
	for flag := range r {
		l[flag] = append(l[flag], r[flag]...)
	}
}
1323800
func (mi *mergeInfo) merge(dst, src pointer) {
	if dst.isNil() {
		panic("proto: nil destination")
	}
	if src.isNil() {
		return // Nothing to do.
	}

	if atomic.LoadInt32(&mi.initialized) == 0 {
		mi.computeMergeInfo()
	}

	for _, fi := range mi.fields {
		sfp := src.offset(fi.field)

		// As an optimization, we can avoid the merge function call cost
		// if we know for sure that the source will have no effect
		// by checking if it is the zero value.
		if unsafeAllowed {
			if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string
				continue
			}
			if fi.basicWidth > 0 {
				switch {
				case fi.basicWidth == 1 && !*sfp.toBool():
					continue
				case fi.basicWidth == 4 && *sfp.toUint32() == 0:
					continue
				case fi.basicWidth == 8 && *sfp.toUint64() == 0:
					continue
				}
			}
		}

		dfp := dst.offset(fi.field)
		fi.merge(dfp, sfp)
	}

	// TODO: Make this faster?
	out := dst.asPointerTo(mi.typ).Elem()
	in := src.asPointerTo(mi.typ).Elem()
	if emIn, err := extendable(in.Addr().Interface()); err == nil {
		emOut, _ := extendable(out.Addr().Interface())
		mIn, muIn := emIn.extensionsRead()
		if mIn != nil {
			mOut := emOut.extensionsWrite()
			muIn.Lock()
			mergeExtension(mOut, mIn)
			muIn.Unlock()
		}
	}

	if mi.unrecognized.IsValid() {
		if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 {
			*dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...)
		}
	}
}
635811
func (c *Cell) Merge(hcells, vcells int) {
	c.HMerge = hcells
	c.VMerge = vcells
}
1137955
func Merge(dst map[string]interface{}, srcs ...map[string]interface{}) (map[string]interface{}, error) {
	for _, src := range srcs {
		dst = mergeValues(src, dst)
	}
	return dst, nil
}
1049154
func (s *StatsBase) Merge(o Stats) {
	s.F.SentBytes += o.SentBytes()
	s.F.SentMessages += o.SentMessages()
	s.F.DiscardedMessages += o.DiscardedMessages()
	s.F.Errors += o.Errors()
}
1060725
func (c *ServiceClient) merge(ops *operations) {
	for _, s := range ops.regServices {
		c.services[s.ID] = s
	}
	for _, check := range ops.regChecks {
		c.checks[check.ID] = check
	}
	for _, s := range ops.scripts {
		c.scripts[s.id] = s
	}
	for _, sid := range ops.deregServices {
		delete(c.services, sid)
	}
	for _, cid := range ops.deregChecks {
		if script, ok := c.runningScripts[cid]; ok {
			script.cancel()
			delete(c.scripts, cid)
			delete(c.runningScripts, cid)
		}
		delete(c.checks, cid)
	}
	metrics.SetGauge([]string{"client", "consul", "services"}, float32(len(c.services)))
	metrics.SetGauge([]string{"client", "consul", "checks"}, float32(len(c.checks)))
	metrics.SetGauge([]string{"client", "consul", "script_checks"}, float32(len(c.runningScripts)))
}