// UnChain unlinks the current chain from the set and reconnects the others
194185
func (r *Chain) UnChain() {
	prev := r.prev
	next := r.next

	if prev != nil && next != nil {
		prev.UseNext(next)
		next.UsePrev(prev)
		return
	}

	prev.UseNext(nil)
}
1044752
func Connect(mo Chains, so ...Chains) Chains {
	for _, sof := range so {
		func(do Chains) {
			mo.Chain(do)
		}(sof)
	}
	return mo
}
251501
func ChainHashUbiquity(chain []*x509.Certificate) HashUbiquity {
	ret := math.MaxInt32
	for _, cert := range chain {
		uscore := int(hashUbiquity(cert))
		if ret > uscore {
			ret = uscore
		}
	}
	return HashUbiquity(ret)
}
417591
func (c *chainRegistry) LookupChain(targetChain chainCode) (*chainControl, bool) {
	c.RLock()
	cc, ok := c.activeChains[targetChain]
	c.RUnlock()
	return cc, ok
}
1137237
func (key *Key) Unbind(data []byte) ([]byte, error) {
	var encdata C.TSS_HENCDATA
	var dataLen C.UINT32
	var cData *C.BYTE

	err := tspiError(C.Tspi_Context_CreateObject(key.context, C.TSS_OBJECT_TYPE_ENCDATA, C.TSS_ENCDATA_BIND, (*C.TSS_HOBJECT)(&encdata)))
	if err != nil {
		return nil, err
	}

	err = tspiError(C.Tspi_SetAttribData((C.TSS_HOBJECT)(encdata), C.TSS_TSPATTRIB_ENCDATA_BLOB, C.TSS_TSPATTRIB_ENCDATABLOB_BLOB, (C.UINT32)(len(data)), (*C.BYTE)(unsafe.Pointer(&data[0]))))
	if err != nil {
		return nil, err
	}

	err = tspiError(C.Tspi_Data_Unbind(encdata, key.handle, &dataLen, &cData))
	if err != nil {
		return nil, err
	}

	blob := C.GoBytes(unsafe.Pointer(cData), (C.int(dataLen)))
	C.Tspi_Context_FreeMemory(key.context, cData)
	return blob, nil
}
418452
func (wc *writerChain) Unwrap() (w io.Writer) {
	next := wc.next
	if next == nil {
		return nil
	}

	w = wc.top
	wc.top = next.top
	wc.next = next.next

	return w
}
1327442
func (pgb *ChainDBRPC) GetChainWork(hash *chainhash.Hash) (string, error) {
	return rpcutils.GetChainWork(pgb.Client, hash)
}
407003
func (ipt *IPTables) ClearChain(table, chain string) error {
	err := ipt.NewChain(table, chain)

	// the exit code for "this table already exists" is different for
	// different iptables modes
	existsErr := 1
	if ipt.mode == "nf_tables" {
		existsErr = 4
	}

	eerr, eok := err.(*Error)
	switch {
	case err == nil:
		return nil
	case eok && eerr.ExitStatus() == existsErr:
		// chain already exists. Flush (clear) it.
		return ipt.run("-t", table, "-F", chain)
	default:
		return err
	}
}
1215569
func (_m *RouterGroup) Chain() alice.Chain {
	ret := _m.Called()

	var r0 alice.Chain
	if rf, ok := ret.Get(0).(func() alice.Chain); ok {
		r0 = rf()
	} else {
		r0 = ret.Get(0).(alice.Chain)
	}

	return r0
}
474464
func Chain(outer Middleware, others ...Middleware) Middleware {
	return func(next Endpoint) Endpoint {
		for i := len(others) - 1; i >= 0; i-- { // reverse
			next = others[i](next)
		}
		return outer(next)
	}
}
6983
func (api *API) middlewareChain(c APIContexter, w http.ResponseWriter, r *http.Request) {
	for _, middleware := range api.middlewares {
		middleware(c, w, r)
	}
}
813695
func SetChains(cs []Chain) {
	newcs := []Chain{}
	// migrate old chain style
	for _, c := range cs {
		for _, el := range c.Elements {
			if el.Action.Name != "" {
				el.Action.ID = UUID()
				c.Actions = append(c.Actions, el.Action.ID)
				actions = append(actions, el.Action)
			}
			if el.Filter.Name != "" {
				//FIXME: migrate old style filters
				c.Filters = append(c.Filters, el.Filter.Options.Value.(string))
			}
		}
		c.Elements = []ChainElement{}

		newcs = append(newcs, c)
	}

	chains = newcs
}
44078
func NewGlobalChain(name string, runner command_runner.CommandRunner, logger lager.Logger) Chain {
	logger = logger.Session("global-chain", lager.Data{
		"name": name,
	})
	return &chain{name: name, logChainName: "", runner: &logging.Runner{runner, logger}, logger: logger}
}
682926
func (w *Wallet) Unpair(pin []byte) error {
	w.lock.Lock()
	defer w.lock.Unlock()

	if !w.session.paired() {
		return fmt.Errorf("wallet %x not paired", w.PublicKey)
	}
	if err := w.session.verifyPin(pin); err != nil {
		return fmt.Errorf("failed to verify pin: %s", err)
	}
	if err := w.session.unpair(); err != nil {
		return fmt.Errorf("failed to unpair: %s", err)
	}
	if err := w.Hub.setPairing(w, nil); err != nil {
		return err
	}
	return nil
}
761361
func (p Pointers) Unset(i int) {
	p[uint(i)>>ptrShift] &^= 1 << (uint(i) & ptrModMask)
}
715797
func (h *Handle) Unset(ordinal uint64) error {
	if err := h.validateOrdinal(ordinal); err != nil {
		return err
	}
	_, err := h.set(ordinal, 0, 0, false, true, false)
	return err
}
1054884
func (ca *ConnackPacket) Unpack(b io.Reader) {
	ca.TopicNameCompression = decodeByte(b)
	ca.ReturnCode = decodeByte(b)
}