// Drop removes a single stashed state from the stash list.
//
// 'index' is the position within the stash list. 0 points
// to the most recent stashed state.
//
// Returns error code ErrNotFound if there's no stashed
// state for the given index.
969792
func (c *StashCollection) Drop(index int) error {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_stash_drop(c.repo.ptr, C.size_t(index))
	runtime.KeepAlive(c)
	if ret < 0 {
		return MakeGitError(ret)
	}
	return nil
}
163322
func (s *CloseIndexService) Index(index string) *CloseIndexService {
	s.index = index
	return s
}
368352
func (s *SACKScoreboard) Delete(seq seqnum.Value) {
	if s.Empty() {
		return
	}
	toDelete := []btree.Item{}
	toInsert := []btree.Item{}
	r := header.SACKBlock{seq, seq.Add(1)}
	s.ranges.DescendLessOrEqual(r, func(i btree.Item) bool {
		if i == r {
			return true
		}
		sb := i.(header.SACKBlock)
		toDelete = append(toDelete, i)
		if sb.End.LessThanEq(seq) {
			s.sacked -= sb.Start.Size(sb.End)
		} else {
			newSB := header.SACKBlock{seq, sb.End}
			toInsert = append(toInsert, newSB)
			s.sacked -= sb.Start.Size(seq)
		}
		return true
	})
	for _, sb := range toDelete {
		s.ranges.Delete(sb)
	}
	for _, sb := range toInsert {
		s.ranges.ReplaceOrInsert(sb)
	}
}
1165083
func Drop(in interface{}, n int) interface{} {
	value := reflect.ValueOf(in)
	valueType := value.Type()

	kind := value.Kind()

	if kind == reflect.Array || kind == reflect.Slice {
		length := value.Len()

		resultSlice := makeSlice(value, length-n)

		j := 0
		for i := n; i < length; i++ {
			resultSlice.Index(j).Set(value.Index(i))
			j++
		}

		return resultSlice.Interface()

	}

	panic(fmt.Sprintf("Type %s is not supported by Drop", valueType.String()))
}
610493
func (session *Session) DropIndexes(bean interface{}) error {
	if session.isAutoClose {
		defer session.Close()
	}

	return session.dropIndexes(bean)
}
594341
func (tx *Tx) DropTable(model interface{}, opt *orm.DropTableOptions) error {
	return orm.DropTable(tx, model, opt)
}
440811
func (tx *Tx) DropIndex(name string) error {
	if tx.db == nil {
		return ErrTxClosed
	} else if !tx.writable {
		return ErrTxNotWritable
	} else if tx.wc.itercount > 0 {
		return ErrTxIterating
	}
	if name == "" {
		// cannot drop the default "keys" index
		return ErrInvalidOperation
	}
	idx, ok := tx.db.idxs[name]
	if !ok {
		return ErrNotFound
	}
	// delete from the map.
	// this is all that is needed to delete an index.
	delete(tx.db.idxs, name)
	if tx.wc.rbkeys == nil {
		// store the index in the rollback map.
		if _, ok := tx.wc.rollbackIndexes[name]; !ok {
			// we use a non-nil copy of the index without the data to indicate that the
			// index should be rebuilt upon rollback.
			tx.wc.rollbackIndexes[name] = idx.clearCopy()
		}
	}
	return nil
}
35559
func (s *DB) DropTable(values ...interface{}) *DB {
	db := s.clone()
	for _, value := range values {
		if tableName, ok := value.(string); ok {
			db = db.Table(tableName)
		}

		db = db.NewScope(value).dropTable().db
	}
	return db
}
57826
func (s *Stack) Pop() (interface{}, error) {
	s.l.Lock()
	defer s.l.Unlock()
	l := len(s.s)
	if l > 0 {
		item := s.s[l-1]
		s.s = s.s[:l-1]
		return item, nil
	}
	return nil, ErrEmptyStack{action: "Pop"}
}
387182
func DropAddrIndex(db database.DB, interrupt <-chan struct{}) error {
	return dropIndex(db, addrIndexKey, addrIndexName, interrupt)
}
928456
func (s *nodeStack) index(n *Node) int {
	for i := len(*s) - 1; i >= 0; i-- {
		if (*s)[i] == n {
			return i
		}
	}
	return -1
}
1288608
func (t *Torrent) Drop() {
	t.cl.lock()
	t.cl.dropTorrent(t.infoHash)
	t.cl.unlock()
}
1031309
func Drop(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "drop", Listener: listener}
}
814084
func (a *Allocation) Index() uint {
	l := len(a.Name)
	prefix := len(a.JobID) + len(a.TaskGroup) + 2
	if l <= 3 || l <= prefix {
		return uint(0)
	}

	strNum := a.Name[prefix : len(a.Name)-1]
	num, _ := strconv.Atoi(strNum)
	return uint(num)
}
1174303
func (pool *ReaderPool) dropAll(doSave bool) error {
	pool.Lock() // synchronized
	defer pool.Unlock()

	var priorE error
	for len(pool.readerMap) > 0 {
		for k, rld := range pool.readerMap {
			if doSave {
				ok, err := rld.writeLiveDocs(pool.owner.directory)
				if err != nil {
					return err
				}
				if ok {
					// Make sure we only write del docs and field updates for a live segment:
					assert(pool.infoIsLive(rld.info))
					// Must checkpoint because we just
					// created new _X_N.del and field updates files;
					// don't call IW.checkpoint because that also
					// increments SIS.version, which we do not want to
					// do here: it was done previously (after we
					// invoked BDS.applyDeletes), whereas here all we
					// did was move the state to disk:
					err = pool.owner.checkpointNoSIS()
					if err != nil {
						return err
					}
				}
			}

			// Important to remove as-we-go, not with .clear()
			// in the end, in case we hit an exception;
			// otherwise we could over-decref if close() is
			// called again:
			delete(pool.readerMap, k)

			// NOTE: it is allowed that these decRefs do not
			// actually close the SRs; this happens when a
			// near real-time reader is kept open after the
			// IndexWriter instance is closed:
			err := rld.dropReaders()
			if err != nil {
				if doSave {
					return err
				}
				if priorE == nil {
					priorE = err
				}
			}
		}
	}
	assert(len(pool.readerMap) == 0)
	return priorE
}
570397
func (s *Stack) Pop() (*Item, error) {
	s.Lock()
	defer s.Unlock()

	// Check if stack is closed.
	if !s.isOpen {
		return nil, ErrDBClosed
	}

	// Try to get the next item in the stack.
	item, err := s.getItemByID(s.head)
	if err != nil {
		return nil, err
	}

	// Remove this item from the stack.
	if err := s.db.Delete(item.Key, nil); err != nil {
		return nil, err
	}

	// Decrement head position.
	s.head--

	return item, nil
}
900817
func (p *PriorityQueue) Pop() (interface{}, error) {
	if len(*p.itemHeap) == 0 {
		return nil, errors.New("empty queue")
	}

	item := heap.Pop(p.itemHeap).(*item)
	delete(p.lookup, item.value)
	return item.value, nil
}