// Remove removes and returns the element from the front of the queue. If the
// queue is empty, the call will panic.
495133
func (q *Queue) Remove() interface{} {
	if q.count <= 0 {
		panic("queue: Remove() called on empty queue")
	}
	ret := q.buf[q.head]
	q.buf[q.head] = nil
	// bitwise modulus
	q.head = (q.head + 1) & (len(q.buf) - 1)
	q.count--
	// Resize down if buffer 1/4 full.
	if len(q.buf) > minQueueLen && (q.count<<2) == len(q.buf) {
		q.resize()
	}
	return ret
}
697658
func (n *node) remove() error {
	if n.parent == nil {
		return errors.New(ErrCannotRemoveRoot, errorMessages)
	}
	for i, child := range n.parent.children {
		if child == n {
			n.parent.children = append(n.parent.children[:i], n.parent.children[i+1:]...)
			return nil
		}
	}
	panic("cannot find node to remove at parent")
}
1008306
func (t *transformer) remove(key string) bool {
	t.mut.Lock()
	defer t.mut.Unlock()
	if _, found := t.cache[key]; found {
		delete(t.cache, key)
		return true
	}
	return false
}
1329123
func (d *requestDistributor) remove(r *distReq) {
	r.sentChn = nil
	if r.element != nil {
		d.reqQueue.Remove(r.element)
		r.element = nil
	}
}
1260368
func (s *podSet) Remove(pod *v1.Pod) {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	delete(s.set, podId(pod))
}
158419
func (sb *shardBuffer) remove(toRemove *entry) {
	sb.mu.Lock()
	defer sb.mu.Unlock()

	if sb.queue == nil {
		// Queue is cleared because we're already in the DRAIN phase.
		return
	}

	// If entry is still in the queue, delete it and cancel it internally.
	for i, e := range sb.queue {
		if e == toRemove {
			// Delete entry at index "i" from slice.
			sb.queue = append(sb.queue[:i], sb.queue[i+1:]...)

			// Cancel the entry's "bufferCtx".
			// The usual drain or eviction code would unblock the request and then
			// wait for the "bufferCtx" to be done.
			// But this code path is different because it's going to return an error
			// to the request and not the "e.bufferCancel" function i.e. the request
			// cannot cancel the "bufferCtx" itself.
			// Therefore, we call "e.bufferCancel". This also avoids that the
			// context's Go routine could leak.
			e.bufferCancel()
			// Release the buffer slot and close the "e.done" channel.
			// By closing "e.done", we finish it explicitly and timeoutThread will
			// find out about it as well.
			sb.unblockAndWait(e, nil /* err */, true /* releaseSlot */, false /* blockingWait */)

			// Track it as "ContextDone" eviction.
			statsKeyWithReason := append(sb.statsKey, string(evictedContextDone))
			requestsEvicted.Add(statsKeyWithReason, 1)
			return
		}
	}

	// Entry was already removed. Keep the queue as it is.
}
1226146
func (c *ARC) Remove(key interface{}) bool {
	c.mu.Lock()
	defer c.mu.Unlock()

	return c.remove(key)
}
786490
func (s *Selection) Remove(l line.Line) {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	s.tree.Delete(l)
}
1086882
func (e *Element) Remove() {
	if !e.Removed() {
		e.attrs = append(e.attrs, &Attribute{"haikuRemoved", ""})
		e.Mutation.Remove()
	}
}
1205257
func (s *ReactionsService) Remove(name string) *ReactionsRemoveCall {
	var call ReactionsRemoveCall
	call.service = s
	call.name = name
	return &call
}
726713
func (fb *Firebase) Remove() error {
	_, _, err := fb.doRequest("DELETE", nil)
	if err != nil {
		return err
	}
	return nil
}
1007504
func (b *Box) Remove(i int) {
	if len(b.children) <= i || i < 0 {
		return
	}

	b.children = append(b.children[:i], b.children[i+1:]...)
}
1001838
func (l *Lambda) remove(kind, name string, m map[string]interface{}) {
	l.log(kind, name, m, '-', red)
}
495924
func (q *queue) Remove() interface{} {
	if q.length == 0 {
		panic("underflow")
	}
	item := q.data[q.head]
	q.data[q.head] = nil
	q.head++
	q.length--
	if q.length == 0 {
		q.head = 0
		q.tail = 0
	}
	return item
}
1115154
func (l *List) remove(e *Element) *Element {
	if e.prev != nil {
		e.prev.next = e.next
	}
	if e.next != nil {
		e.next.prev = e.prev
	}
	e.next = nil // avoid memory leaks
	e.prev = nil // avoid memory leaks
	if e.list == l {
		l.len--
	}

	e.list = nil
	return e
}
1019948
func (c *keyValueChanger) Remove() error {
	if c.err != nil {
		return c.err
	}
	return c.node.remove()
}
345504
func (l *udpPacketList) Remove(e *udpPacket) {
	prev := udpPacketElementMapper{}.linkerFor(e).Prev()
	next := udpPacketElementMapper{}.linkerFor(e).Next()

	if prev != nil {
		udpPacketElementMapper{}.linkerFor(prev).SetNext(next)
	} else {
		l.head = next
	}

	if next != nil {
		udpPacketElementMapper{}.linkerFor(next).SetPrev(prev)
	} else {
		l.tail = prev
	}
}