// Extensions returns a list of extensions for the given handle.
558512
func (h Handle) Extensions() (extensions []HandleExtension) {
	if h.ConflictInfo != nil {
		extensions = append(extensions, *h.ConflictInfo)
	}
	if h.FinalizedInfo != nil {
		extensions = append(extensions, *h.FinalizedInfo)
	}
	return extensions
}
952448
func ParseHandleExtensionSuffix(s string) ([]HandleExtension, error) {
	exts := handleExtensionRegex.FindAllStringSubmatch(s, 2)
	if len(exts) < 1 || len(exts) > 2 {
		return nil, errHandleExtensionInvalidString
	}
	extMap := make(map[HandleExtensionType]bool)
	var extensions []HandleExtension
	for _, e := range exts {
		ext, err := parseHandleExtension(e)
		if err != nil {
			return nil, err
		}
		if extMap[ext.Type] {
			// No duplicate extension types in the same suffix.
			return nil, errHandleExtensionInvalidString
		}
		extMap[ext.Type] = true
		extensions = append(extensions, *ext)
	}
	return extensions, nil
}
322665
func (c *Context) GetSupportedExtensions() []string {
	ext := c.Call("getSupportedExtensions")
	extensions := make([]string, ext.Length())
	for i := 0; i < ext.Length(); i++ {
		extensions[i] = ext.Index(i).String()
	}
	return extensions
}
129758
func Compresses(exts []string) HandlerFunc {
	extsmap := make(map[string]bool)
	for _, ext := range exts {
		extsmap[strings.ToLower(ext)] = true
	}

	return func(ctx *Context) {
		ae := ctx.Req().Header.Get("Accept-Encoding")
		if ae == "" {
			ctx.Next()
			return
		}

		if len(extsmap) > 0 {
			ext := strings.ToLower(path.Ext(ctx.Req().URL.Path))
			if _, ok := extsmap[ext]; ok {
				compress(ctx, "auto")
				return
			}
		}

		if action := ctx.Action(); action != nil {
			if c, ok := action.(Compresser); ok {
				compress(ctx, c.CompressType())
				return
			}
		}

		// if blank, then no compress
		ctx.Next()
	}
}
1196547
func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
	return extensionMaps[reflect.TypeOf(pb).Elem()]
}
820266
func (r *Registry) applyHandlers(f func(o RegisterObject)) {
	r.m.Lock()
	handlers := make([]RegisterObject, 0, len(r.handlers))
	for _, handler := range r.handlers {
		handlers = append(handlers, handler)
	}
	r.m.Unlock()

	for i := range handlers {
		f(handlers[i])
	}
}
43529
func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
	epb, err := extendable(pb)
	if err != nil {
		return nil, err
	}
	extensions = make([]interface{}, len(es))
	for i, e := range es {
		extensions[i], err = GetExtension(epb, e)
		if err == ErrMissingExtension {
			err = nil
		}
		if err != nil {
			return
		}
	}
	return
}
1073806
func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) {
	if m == nil {
		return b, nil
	}

	// Sort the keys to provide a deterministic encoding.
	keys := make([]int, 0, len(m))
	for k := range m {
		keys = append(keys, int(k))
	}
	sort.Ints(keys)

	var err error
	var nerr nonFatal
	for _, k := range keys {
		e := m[int32(k)]
		if e.value == nil || e.desc == nil {
			// Extension is only in its encoded form.
			b = append(b, e.enc...)
			continue
		}

		// We don't skip extensions that have an encoded form set,
		// because the extension value may have been mutated after
		// the last time this function was called.

		ei := u.getExtElemInfo(e.desc)
		v := e.value
		p := toAddrPointer(&v, ei.isptr, ei.deref)
		b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
		if !nerr.Merge(err) {
			return b, err
		}
	}
	return b, nerr.E
}
383713
func HasExtension(filename string, extensions map[string]bool) bool {
	var ext string
	if e := filepath.Ext(filename); strings.HasPrefix(e, ".") {
		ext = e[1:]
	} else {
		return false
	}

	// Case-insensitive lookup.
	// Optimistically assume a short ASCII extension and be
	// allocation-free in that case.
	var buf [10]byte
	lower := buf[:0]
	const utf8RuneSelf = 0x80 // from utf8 package, but not importing it.
	for i := 0; i < len(ext); i++ {
		c := ext[i]
		if c >= utf8RuneSelf {
			// Slow path.
			return extensions[strings.ToLower(ext)]
		}
		if 'A' <= c && c <= 'Z' {
			lower = append(lower, c+('a'-'A'))
		} else {
			lower = append(lower, c)
		}
	}
	// The conversion from []byte to string doesn't allocate in
	// a map lookup.
	return extensions[string(lower)]
}
1314812
func Extents(font *truetype.Font, fontSize float64, text string) (int, int) {
	c := ftContext(font, fontSize)
	w, h, err := c.MeasureString(text)
	if err != nil {
		return 0, 0
	}
	return int(w / 256), int(h / 256)
}
307346
func (c *Capabilities) addExtension(r io.Reader) error {
	var buf bytes.Buffer
	encoder := base64.NewEncoder(base64.StdEncoding, &buf)
	if _, err := io.Copy(encoder, bufio.NewReader(r)); err != nil {
		return err
	}
	encoder.Close()
	c.Extensions = append(c.Extensions, buf.String())
	return nil
}
586532
func (c HandlerChain) Append(h ...Handler) HandlerChain {
	_c := make(HandlerChain, len(c)+len(h))
	copy(_c, c)
	copy(_c[len(c):], h)
	return _c
}
1306434
func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
	if e.p == nil {
		e.p = new(struct {
			mu           sync.Mutex
			extensionMap map[int32]Extension
		})
		e.p.extensionMap = make(map[int32]Extension)
	}
	return e.p.extensionMap
}
538947
func (mc MiddlewareChain) Extend(mw ...Middleware) MiddlewareChain {
	if len(mw) == 0 {
		return mc
	}

	ext := make([]Middleware, 0, len(mc.middleware)+len(mw))
	return MiddlewareChain{append(append(ext, mc.middleware...), mw...)}
}
456523
func (window *Window) VulkanGetInstanceExtensions() []string {
	var count C.uint
	C.SDL_Vulkan_GetInstanceExtensions(window.cptr(), &count, nil)
	if count == 0 {
		return nil
	}

	strptrs := make([]*C.char, uint(count))
	C.SDL_Vulkan_GetInstanceExtensions(window.cptr(), &count, &strptrs[0])
	extensions := make([]string, uint(count))
	for i := range strptrs {
		extensions[i] = C.GoString(strptrs[i])
	}
	return extensions
}
330603
func (admissionHandler chainAdmissionHandler) Handles(operation Operation) bool {
	for _, handler := range admissionHandler {
		if handler.Handles(operation) {
			return true
		}
	}
	return false
}
1073597
func (a *Module) Add(args ...interface{}) *Module {
	for _, c := range args {
		a.AddHandler(c).Auto()
	}
	return a
}