// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterRef
342284
func (c *NWFilter) Ref() error {
	var err C.virError
	ret := C.virNWFilterRefWrapper(c.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
1007628
func (c *Interface) Ref() error {
	var err C.virError
	ret := C.virInterfaceRefWrapper(c.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
1063919
func ContainsVarRef(expr Expr) bool {
	var v containsVarRefVisitor
	Walk(&v, expr)
	return v.contains
}
69792
func (c *DomainSnapshot) Ref() error {
	var err C.virError
	ret := C.virDomainSnapshotRefWrapper(c.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
1289676
func Filter(r io.Reader, w io.Writer, sync bool, filter LineFilterFunc) error {
	var (
		save  = func([]byte) {}
		flush = func() error { return nil }
	)

	if w != nil {
		var bufw interface {
			Write([]byte) (int, error)
			WriteString(string) (int, error)
		}

		if sync { // use bufio.Writer
			bw := BufWriter(w)
			flush = func() error {
				return bw.Flush()
			}
			bufw = bw
		} else { // use bytes.Buffer
			bw := bytes.NewBuffer(make([]byte, 0, FileBufferSIze))
			flush = func() error {
				_, err := w.Write(bw.Bytes())
				return err
			}
			bufw = bw
		}

		save = func(line []byte) {
			bufw.Write(line)
			bufw.WriteString("\n")
		}
	}

	if filter == nil {
		filter = NopLineFilter
	}

	var (
		line    []byte
		linenum int
		err     error
		br      = BufReader(r)
	)

	for err == nil {
		if line, _, err = br.ReadLine(); err == nil {
			linenum++
			if line, err = filter(linenum, line); err == nil || err == io.EOF {
				if line != nil {
					save(line)
				}
			}
		}
	}

	if err == io.EOF {
		flush()
		err = nil
	}

	return err
}
878314
func filterTargets(
	wcs []io.WriteCloser,
	line []byte,
	filter func(io.WriteCloser, []byte) bool,
) []io.WriteCloser {
	var filteredTargets []io.WriteCloser

	for _, c := range wcs {
		if !filter(c, line) {
			filteredTargets = append(filteredTargets, c)
		}
	}
	return filteredTargets
}
253920
func (p Path) TailRef() BlockRef {
	return p.Path[len(p.Path)-1].Ref()
}
968941
func Filter(vs []string, f func(string) bool) []string {
	r := make([]string, 0, len(vs))
	for _, v := range vs {
		if f(v) {
			r = append(r, v)
		}
	}
	return r
}
92849
func (c *Connect) LookupNWFilterByName(name string) (*NWFilter, error) {
	cName := C.CString(name)
	defer C.free(unsafe.Pointer(cName))
	var err C.virError
	ptr := C.virNWFilterLookupByNameWrapper(c.ptr, cName, &err)
	if ptr == nil {
		return nil, makeError(&err)
	}
	return &NWFilter{ptr: ptr}, nil
}
420806
func (fn FilterFunc) Filter(rels []*rspb.Release) (rets []*rspb.Release) {
	for _, rel := range rels {
		if fn.Check(rel) {
			rets = append(rets, rel)
		}
	}
	return
}
467560
func useLazyRef(opts ...options.Opt) bool {
	chk := &refOptCheck{}
	options.Apply(chk, opts)
	return chk.useRef
}
849583
func (_ENS *ENSFilterer) FilterNewOwner(opts *bind.FilterOpts, node [][32]byte, label [][32]byte) (*ENSNewOwnerIterator, error) {

	var nodeRule []interface{}
	for _, nodeItem := range node {
		nodeRule = append(nodeRule, nodeItem)
	}
	var labelRule []interface{}
	for _, labelItem := range label {
		labelRule = append(labelRule, labelItem)
	}

	logs, sub, err := _ENS.contract.FilterLogs(opts, "NewOwner", nodeRule, labelRule)
	if err != nil {
		return nil, err
	}
	return &ENSNewOwnerIterator{contract: _ENS.contract, event: "NewOwner", logs: logs, sub: sub}, nil
}
1100055
func (r *Response) Filter(fn FilterResponseFunc) *Response {
	r.Filters = append(r.Filters, fn)
	return r
}
1039800
func (f *NWFilterBinding) GetXMLDesc(flags uint32) (string, error) {
	if C.LIBVIR_VERSION_NUMBER < 4005000 {
		return "", makeNotImplementedError("virNWFilterBindingGetXMLDesc")
	}
	var err C.virError
	result := C.virNWFilterBindingGetXMLDescWrapper(f.ptr, C.uint(flags), &err)
	if result == nil {
		return "", makeError(&err)
	}
	xml := C.GoString(result)
	C.free(unsafe.Pointer(result))
	return xml, nil
}
3040
func (c *Connect) LookupNWFilterByUUID(uuid []byte) (*NWFilter, error) {
	if len(uuid) != C.VIR_UUID_BUFLEN {
		return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
			int(C.VIR_UUID_BUFLEN))
	}
	cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
	for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
		cUuid[i] = C.uchar(uuid[i])
	}
	var err C.virError
	ptr := C.virNWFilterLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
	if ptr == nil {
		return nil, makeError(&err)
	}
	return &NWFilter{ptr: ptr}, nil
}
430826
func HclWhiteRef(h, c, l float64, wref [3]float64) Color {
	L, a, b := HclToLab(h, c, l)
	return LabWhiteRef(L, a, b, wref)
}
895856
func SetRetrieversFilter(f IDFilter) IDFilter {
	monitor.RLock()
	defer monitor.RUnlock()
	return monitor.backend().SetRetrieversFilter(f)
}