// Dup makes a copy of the ACL.
971472
func (acl *ACL) Dup() (*ACL, error) {
	cdup, _ := C.acl_dup(acl.a)
	if cdup == nil {
		return nil, fmt.Errorf("unable to dup ACL")
	}
	return &ACL{cdup}, nil
}
346018
func (b PolicyBindings) Clone() PolicyBindings {
	clone := make(PolicyBindings, len(b))
	for role, members := range b {
		membersCopy := make(membersSet, len(members))
		for k, v := range members {
			membersCopy[k] = v
		}
		clone[role] = membersCopy
	}
	return clone
}
83457
func (r *ResponseDefinition) Dup() *ResponseDefinition {
	res := ResponseDefinition{
		Name:        r.Name,
		Status:      r.Status,
		Description: r.Description,
		MediaType:   r.MediaType,
		ViewName:    r.ViewName,
	}
	if r.Headers != nil {
		res.Headers = DupAtt(r.Headers)
	}
	return &res
}
494130
func (c *createCountingFs) ReportDuplicates() string {
	c.mu.Lock()
	defer c.mu.Unlock()

	var dupes []string

	for k, v := range c.fileCount {
		if v > 1 {
			dupes = append(dupes, fmt.Sprintf("%s (%d)", k, v))
		}
	}

	if len(dupes) == 0 {
		return ""
	}

	sort.Strings(dupes)

	return strings.Join(dupes, ", ")
}
448688
func (connector *Connector) Clone(url string, version repositories.Version, destPath string) (repo repositories.Repository, err error) {
	var (
		out  bytes.Buffer
		args []string
	)
	if version.Branch == "" {
		version.Branch = "master"
	}
	if strings.HasPrefix(url, "git+") {
		url = url[len("git+"):]
	}
	// clone
	args = []string{"clone", "--branch", version.Branch, url, destPath}
	cmd := exec.Command("git", args...)
	cmd.Stdout = &out
	cmd.Stderr = &out
	if err = cmd.Run(); err != nil {
		return nil, fmt.Errorf("external git app fail %v: %v %v", args, err, string(out.Bytes()))
	}
	// checkout
	if version.Revision == "" {
		return &Repository{
			path: destPath,
		}, nil
	}
	args = []string{"checkout", version.Branch}
	cmd = exec.Command("git", args...)
	cmd.Dir = destPath
	cmd.Stdout = &out
	cmd.Stderr = &out
	if err = cmd.Run(); err != nil {
		return nil, fmt.Errorf("external git app fail %v: %v %v", args, err, string(out.Bytes()))
	}
	return &Repository{
		path: destPath,
	}, nil
}
561539
func (d *Context) PushUint(val uint) {
	C.duk_push_uint(d.duk_context, C.duk_uint_t(val))
}
608390
func CopyDirectory(src, dest string) error {
	return filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
		subPath := path + "/" + info.Name()
		if info.IsDir() {
			return MkdirAll(subPath, filesystem.DefaultUnixDirMode)
		}
		return CopyFile(src+subPath, dest+subPath)
	})
}
291849
func Copy(src, dest string) error {
	if IsDir(src) {
		return CopyDirectory(src, dest)
	}
	return CopyFile(src, dest)
}
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(),
	}
}
153975
func (s Set) Dup() Set {
	ret := make(Set, len(s))
	for k := range s {
		ret[k] = struct{}{}
	}
	return ret
}
27048
func (a *aclIterator) Swap(i, j int) {
	a.acls[i], a.acls[j] = a.acls[j], a.acls[i]
}
592400
func Dup(s Streamer) (t, u Streamer) {
	var tBuf, uBuf [][2]float64
	return &dup{&tBuf, &uBuf, s}, &dup{&uBuf, &tBuf, s}
}
908258
func (fs *FileSet) Duplicate() (*FileSet, error) {
	return NewFileSet(fs.sfile, fs.files)
}
578220
func CopyMap(m map[string]string) map[string]string {
	if m == nil {
		return nil
	}
	r := map[string]string{}
	for k, v := range m {
		r[k] = v
	}
	return r
}
787623
func newDupper() *dupper {
	return &dupper{
		dts:  make(map[string]*UserTypeDefinition),
		dmts: make(map[string]*MediaTypeDefinition),
	}
}
886489
func dedupePaths(in []string) []string {
	out := make([]string, 0, len(in))
	var last string
	for _, s := range in {
		// if one of the paths is root there is no filter
		if s == "." {
			return nil
		}
		if strings.HasPrefix(s, last+string(filepath.Separator)) {
			continue
		}
		out = append(out, s)
		last = s
	}
	return out
}
484907
func (a *ACL) Clone(id string, q *WriteOptions) (string, *WriteMeta, error) {
	r := a.c.newRequest("PUT", "/v1/acl/clone/"+id)
	r.setWriteOptions(q)
	rtt, resp, err := requireOK(a.c.doRequest(r))
	if err != nil {
		return "", nil, err
	}
	defer resp.Body.Close()

	wm := &WriteMeta{RequestTime: rtt}
	var out struct{ ID string }
	if err := decodeBody(resp, &out); err != nil {
		return "", nil, err
	}
	return out.ID, wm, nil
}