// GLGetAttribute returns the actual value for an attribute from the current context.
// (https://wiki.libsdl.org/SDL_GL_GetAttribute)
339062
func GLGetAttribute(attr GLattr) (int, error) {
	var _value C.int
	if C.SDL_GL_GetAttribute(attr.c(), &_value) != 0 {
		return int(_value), GetError()
	}
	return int(_value), nil
}
316460
func (d DevicePtr) PtrAttribute(attr PointerAttribute) (unsafe.Pointer, error) {
	var p unsafe.Pointer
	devPtr := C.CUdeviceptr(d)
	a := C.CUpointer_attribute(attr)
	if err := result(C.cuPointerGetAttribute(p, a, devPtr)); err != nil {
		return nil, err
	}
	return p, nil
}
1360230
func MarshalAttribute(a Attribute) (map[string]interface{}, error) {
	ret := make(map[string]interface{})
	marshaledAttrRaw, err := a.MarshalJSON()
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(marshaledAttrRaw, &ret)
	if err != nil {
		return nil, err
	}
	return ret, nil
}
1318890
func (c *Ctx) GetAttributeValue(sh SessionHandle, o ObjectHandle, a []*Attribute) ([]*Attribute, error) {
	// copy the attribute list and make all the values nil, so that
	// the C function can (allocate) fill them in
	pa := make([]C.CK_ATTRIBUTE, len(a))
	for i := 0; i < len(a); i++ {
		pa[i]._type = C.CK_ATTRIBUTE_TYPE(a[i].Type)
	}
	e := C.GetAttributeValue(c.ctx, C.CK_SESSION_HANDLE(sh), C.CK_OBJECT_HANDLE(o), &pa[0], C.CK_ULONG(len(a)))
	if err := toError(e); err != nil {
		return nil, err
	}
	a1 := make([]*Attribute, len(a))
	for i, c := range pa {
		x := new(Attribute)
		x.Type = uint(c._type)
		if int(c.ulValueLen) != -1 {
			buf := unsafe.Pointer(C.getAttributePval(&c))
			x.Value = C.GoBytes(buf, C.int(c.ulValueLen))
			C.free(buf)
		}
		a1[i] = x
	}
	return a1, nil
}
30728
func (self *Collection) LengthAttribute() IntegerAttribute {
	result := &computedLength{
		NewAttribute(VALUE_ONLY, self.length, nil), self,
	}
	return result
}
1369208
func (c *Config) Attributes() ConfigAttributes {
	if c == nil {
		return nil
	}
	result := make(ConfigAttributes)
	for k, v := range c.attributes {
		result[k] = v
	}
	return result
}
160073
func (c ConfigAttributes) Get(attrName string, defaultValue interface{}) interface{} {
	if val, ok := c[attrName]; ok {
		return val
	}
	return defaultValue
}
227281
func (g *Graph) Attr(name string) (starlark.Value, error) {
	impl, ok := graphAttrs[name]
	if !ok {
		return nil, nil // per Attr(...) contract
	}
	return impl.BindReceiver(g), nil
}
254354
func DumpAttributes(aa []*attr) {
	logger.Debug("server", "db", "Generating attribute table:")
	logger.Debug("server", "db", "handle   endh   type")
	for _, a := range aa {
		if a.v != nil {
			logger.Debug("server", "db", fmt.Sprintf("0x%04X 0x%04X 0x%s [% X]", a.h, a.endh, a.typ, a.v))
			continue
		}
		logger.Debug("server", "db", fmt.Sprintf("0x%04X 0x%04X 0x%s", a.h, a.endh, a.typ))
	}
}
193095
func arrayAttribute(a *design.AttributeDefinition) *design.AttributeDefinition {
	return a.Type.(*design.Array).ElemType
}
489956
func validatePathAttributeFlags(t BGPAttrType, flags BGPAttrFlag) string {

	/*
	 * RFC 4271 P.17 For well-known attributes, the Transitive bit MUST be set to 1.
	 */
	if flags&BGP_ATTR_FLAG_OPTIONAL == 0 && flags&BGP_ATTR_FLAG_TRANSITIVE == 0 {
		eMsg := fmt.Sprintf("well-known attribute %s must have transitive flag 1", t)
		return eMsg
	}
	/*
	 * RFC 4271 P.17 For well-known attributes and for optional non-transitive attributes,
	 * the Partial bit MUST be set to 0.
	 */
	if flags&BGP_ATTR_FLAG_OPTIONAL == 0 && flags&BGP_ATTR_FLAG_PARTIAL != 0 {
		eMsg := fmt.Sprintf("well-known attribute %s must have partial bit 0", t)
		return eMsg
	}
	if flags&BGP_ATTR_FLAG_OPTIONAL != 0 && flags&BGP_ATTR_FLAG_TRANSITIVE == 0 && flags&BGP_ATTR_FLAG_PARTIAL != 0 {
		eMsg := fmt.Sprintf("optional non-transitive attribute %s must have partial bit 0", t)
		return eMsg
	}

	// check flags are correct
	if f, ok := PathAttrFlags[t]; ok {
		if f != flags & ^BGP_ATTR_FLAG_EXTENDED_LENGTH & ^BGP_ATTR_FLAG_PARTIAL {
			eMsg := fmt.Sprintf("flags are invalid. attribute type: %s, expect: %s, actual: %s", t, f, flags)
			return eMsg
		}
	}
	return ""
}
229065
func (client *Client) ModifyDiskAttribute(args *ModifyDiskAttributeArgs) error {
	response := ModifyDiskAttributeResponse{}
	err := client.Invoke("ModifyDiskAttribute", args, &response)
	return err
}
1174677
func (f *mounterDefaults) GetAttributes() volume.Attributes {
	klog.V(5).Infof(logPrefix(f.plugin), "using default GetAttributes")
	return volume.Attributes{
		ReadOnly:        f.readOnly,
		Managed:         !f.readOnly,
		SupportsSELinux: f.flexVolume.plugin.capabilities.SELinuxRelabel,
	}
}
686016
func (p *parser) parseAttribute() (*Decl, error) {
	quoted := false
	quoteToken := DoubleQuoteToken

	if p.is(DoubleQuoteToken) || p.is(BacktickToken) {
		quoteToken = p.cur().Token
		quoted = true
		if err := p.next(); err != nil {
			return nil, err
		}
	}

	// shoud be a StringToken here
	// If there is a point after, it's a table name,
	// if not, it's the attribute
	if !p.is(StringToken, StarToken) {
		return nil, p.syntaxError()
	}
	decl := NewDecl(p.cur())

	if quoted {
		// Check there is a closing quote
		if _, err := p.mustHaveNext(quoteToken); err != nil {
			log.Debug("parseAttribute: Missing closing quote")
			return nil, err
		}
	}
	// If no next token,and not quoted, then is was the atribute name
	if err := p.next(); err != nil {
		return decl, nil
	}

	// Now, is it a point ?
	if p.is(PeriodToken) {
		_, err := p.consumeToken(PeriodToken)
		if err != nil {
			return nil, err
		}
		// if so, next must be the attribute name or a star
		attributeDecl, err := p.consumeToken(StringToken, StarToken)
		if err != nil {
			return nil, err
		}
		attributeDecl.Add(decl)
		return attributeDecl, nil
	}

	// Then the first string token was the naked attribute name
	return decl, nil
}
637691
func getAttributesFromCert(cert *x509.Certificate) ([]byte, error) {
	for _, ext := range cert.Extensions {
		if isAttrOID(ext.Id) {
			return ext.Value, nil
		}
	}
	return nil, nil
}
756318
func PgAttributeByAttrelidAttname(db XODB, attrelid pgtypes.Oid, attname pgtypes.Name) (*PgAttribute, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, attrelid, attname, atttypid, attstattarget, attlen, attnum, attndims, attcacheoff, atttypmod, attbyval, attstorage, attalign, attnotnull, atthasdef, attisdropped, attislocal, attinhcount, attcollation, attacl, attoptions, attfdwoptions ` +
		`FROM pg_catalog.pg_attribute ` +
		`WHERE attrelid = $1 AND attname = $2`

	// run query
	XOLog(sqlstr, attrelid, attname)
	pa := PgAttribute{}

	err = db.QueryRow(sqlstr, attrelid, attname).Scan(&pa.Tableoid, &pa.Cmax, &pa.Xmax, &pa.Cmin, &pa.Xmin, &pa.Ctid, &pa.Attrelid, &pa.Attname, &pa.Atttypid, &pa.Attstattarget, &pa.Attlen, &pa.Attnum, &pa.Attndims, &pa.Attcacheoff, &pa.Atttypmod, &pa.Attbyval, &pa.Attstorage, &pa.Attalign, &pa.Attnotnull, &pa.Atthasdef, &pa.Attisdropped, &pa.Attislocal, &pa.Attinhcount, &pa.Attcollation, &pa.Attacl, &pa.Attoptions, &pa.Attfdwoptions)
	if err != nil {
		return nil, err
	}

	return &pa, nil
}
206366
func (s Session) AddAttribute(attribute string, values ...string) Session {
	if len(values) == 0 {
		return s.AddFlag(attribute)
	}
	v := make([]byte, 0, 512)
	v = append(v, attribute...)
	v = appendRune(v, attributesDelimiter)
	v = appendJoinStrings(v, values...)
	return s.append(TypeAttribute, v)
}