// QueryItemRef returns query result as CFTypeRef. You must release it when you are done.
191416
func QueryItemRef(item Item) (C.CFTypeRef, error) {
	cfDict, err := ConvertMapToCFDictionary(item.attr)
	if err != nil {
		return nil, err
	}
	defer Release(C.CFTypeRef(cfDict))

	var resultsRef C.CFTypeRef
	errCode := C.SecItemCopyMatching(cfDict, &resultsRef)
	if Error(errCode) == ErrorItemNotFound {
		return nil, nil
	}
	err = checkError(errCode)
	if err != nil {
		return nil, err
	}
	return resultsRef, nil
}
470307
func (c *TagCache) ResolveExtractedObjectRef(ctx context.Context, pin common.Pin, fileName string) (*api.ObjectRef, error) {
	if err := common.ValidatePin(pin, common.AnyHash); err != nil {
		return nil, err
	}

	ignoreBrokenObjectRef := func(iid string) *api.ObjectRef {
		if err := common.ValidateInstanceID(iid, common.AnyHash); err != nil {
			logging.Errorf(ctx, "Stored object_ref %q for %q in %s is invalid, ignoring it - %s", iid, fileName, pin, err)
			return nil
		}
		return common.InstanceIDToObjectRef(iid)
	}

	c.lock.Lock()
	defer c.lock.Unlock()

	key := makeFileKey(pin.PackageName, pin.InstanceID, fileName)
	if e := c.addedFiles[key]; e != nil {
		return ignoreBrokenObjectRef(e.ObjectRef), nil
	}

	if err := c.lazyLoadLocked(ctx); err != nil {
		return nil, err
	}

	// Most recently used entries are usually at the end, search in reverse as a
	// silly optimization.
	for i := len(c.cache.FileEntries) - 1; i >= 0; i-- {
		e := c.cache.FileEntries[i]
		if e.Package == pin.PackageName && e.InstanceId == pin.InstanceID && e.FileName == fileName {
			return ignoreBrokenObjectRef(e.ObjectRef), nil
		}
	}
	return nil, nil
}
933528
func (cr *cacheRecord) mref(triggerLastUsed bool) *mutableRef {
	ref := &mutableRef{cacheRecord: cr, triggerLastUsed: triggerLastUsed}
	cr.refs[ref] = struct{}{}
	return ref
}
91754
func (s *GitScanner) ScanRef(ref string, cb GitScannerFoundPointer) error {
	callback, err := firstGitScannerCallback(cb, s.FoundPointer)
	if err != nil {
		return err
	}

	opts := s.opts(ScanRefsMode)
	opts.SkipDeletedBlobs = true
	return scanLeftRightToChan(s, callback, ref, "", opts)
}
239762
func (r Billing_Item) GetItem() (resp datatypes.Product_Item, err error) {
	err = r.Session.DoRequest("SoftLayer_Billing_Item", "getItem", nil, &r.Options, &resp)
	return
}
966669
func (c *RefManager) SetRef(id ContainerID, ref *v1.ObjectReference) {
	c.Lock()
	defer c.Unlock()
	c.containerIDToRef[id] = ref
}
538877
func (c *NoteCollection) DefaultRef() (string, error) {
	buf := C.git_buf{}

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ecode := C.git_note_default_ref(&buf, c.repo.ptr)
	runtime.KeepAlive(c)
	if ecode < 0 {
		return "", MakeGitError(ecode)
	}

	ret := C.GoString(buf.ptr)
	C.git_buf_dispose(&buf)

	return ret, nil
}
1169442
func QueryParameter(name, description string) *Parameter {
	p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string", CollectionFormat: CollectionFormatCSV.String()}}
	p.beQuery()
	return p
}
83720
func (f *Footer) AddRef() {
	f.m.Lock()
	f.refs++
	f.m.Unlock()
}
354260
func (d SelectAllBtnDef) getQuery() *search.SearchQuery {
	predicate := d.Props().callbacks.GetQuery()
	if !strings.HasPrefix(predicate, "ref:") {
		return &search.SearchQuery{
			Limit:      -1,
			Expression: predicate,
		}
	}

	// If we've got a ref: predicate, assume the given blobRef is a container, and
	// find its children.
	blobRef := strings.TrimPrefix(predicate, "ref:")
	br, ok := blob.Parse(blobRef)
	if !ok {
		println(`Invalid blobRef in "ref:" predicate: ` + blobRef)
		return nil
	}
	return &search.SearchQuery{
		Limit: -1,
		Constraint: &search.Constraint{Permanode: &search.PermanodeConstraint{
			Relation: &search.RelationConstraint{
				Relation: "parent",
				Any: &search.Constraint{
					BlobRefPrefix: br.String(),
				},
			},
		}},
	}
}
883050
func (s *VolumeStore) hasRef(name string) bool {
	s.globalLock.RLock()
	l := len(s.refs[name])
	s.globalLock.RUnlock()
	return l > 0
}
238226
func GetIssueByRef(ref string) (*Issue, error) {
	n := strings.IndexByte(ref, byte('#'))
	if n == -1 {
		return nil, errors.InvalidIssueReference{ref}
	}

	index := com.StrTo(ref[n+1:]).MustInt64()
	if index == 0 {
		return nil, errors.IssueNotExist{}
	}

	repo, err := GetRepositoryByRef(ref[:n])
	if err != nil {
		return nil, err
	}

	issue, err := GetIssueByIndex(repo.ID, index)
	if err != nil {
		return nil, err
	}

	return issue, issue.LoadAttributes()
}
582538
func UpdateRef(ref *Ref, to []byte, reason string) error {
	return UpdateRefIn("", ref, to, reason)
}
94190
func (f *GFile) QueryInfo(attributes string, flags GFileQueryInfoFlags) (*GFileInfo, error) {
	ptr := C.CString(attributes)
	defer cfree(ptr)

	var gerror *C.GError

	gfileinfo := C.g_file_query_info(
		f.GFile,
		ptr,
		C.GFileQueryInfoFlags(flags),
		nil, // nil is GCancellable, not yet implemented
		&gerror,
	)
	if gerror != nil {
		return nil, glib.ErrorFromNative(unsafe.Pointer(gerror))
	}

	return &GFileInfo{gfileinfo}, nil
}
351461
func TransformRefs(x interface{}, f func(Ref) (Value, error)) (interface{}, error) {
	t := &GenericTransformer{func(x interface{}) (interface{}, error) {
		if r, ok := x.(Ref); ok {
			return f(r)
		}
		return x, nil
	}}
	return Transform(t, x)
}
937489
func (me *TxDatabase) queryAdapter(dataset *Dataset) Adapter {
	return NewAdapter(me.Dialect, dataset)
}
139893
func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error) {
	var u string
	if opt != nil && opt.Type != "" {
		u = fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, opt.Type)
	} else {
		u = fmt.Sprintf("repos/%v/%v/git/refs", owner, repo)
	}
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var rs []*Reference
	resp, err := s.client.Do(ctx, req, &rs)
	if err != nil {
		return nil, resp, err
	}

	return rs, resp, nil
}