github.com/prebid/prebid-server/v2@v2.18.0/openrtb_ext/supplyChain.go (about)

     1  package openrtb_ext
     2  
     3  import (
     4  	"github.com/prebid/openrtb/v20/openrtb2"
     5  	"github.com/prebid/prebid-server/v2/util/ptrutil"
     6  )
     7  
     8  func cloneSupplyChain(schain *openrtb2.SupplyChain) *openrtb2.SupplyChain {
     9  	if schain == nil {
    10  		return nil
    11  	}
    12  	clone := *schain
    13  	clone.Nodes = make([]openrtb2.SupplyChainNode, len(schain.Nodes))
    14  	for i, node := range schain.Nodes {
    15  		clone.Nodes[i] = node
    16  		clone.Nodes[i].HP = ptrutil.Clone(schain.Nodes[i].HP)
    17  	}
    18  
    19  	return &clone
    20  
    21  }