// Put will put the buffer back in the pool, unless cap(buf) is bigger than
// initBufSize, in which case it will be thrown away
173942
func (bp *BufferPool) Put(buf []byte) {
	if len(buf) <= bp.maxBufSize {
		bp.mutex.Lock()
		if bp.pos < int64(bp.poolSize-1) {
			bp.pos++
			bp.pool[bp.pos] = buf
		}
		bp.mutex.Unlock()
	}
}
330826
func (p *bufferPool) Put(bs []byte) {
	c := cap(bs)
	// Don't buffer huge byte slices
	if c > 2*MaxBlockSize {
		return
	}
	for i := range BlockSizes {
		if c >= BlockSizes[i] {
			p.pools[i].Put(&bs)
			return
		}
	}
}
678011
func (i *InmemBackend) Put(ctx context.Context, entry *physical.Entry) error {
	i.permitPool.Acquire()
	defer i.permitPool.Release()

	i.Lock()
	defer i.Unlock()

	return i.PutInternal(ctx, entry)
}
544749
func (b *Buffer) Write(buf []byte) (int, error) {
	// Account for total bytes written
	n := len(buf)
	b.written += int64(n)

	// If the buffer is larger than ours, then we only care
	// about the last size bytes anyways
	if int64(n) > b.size {
		buf = buf[int64(n)-b.size:]
	}

	// Copy in place
	remain := b.size - b.writeCursor
	copy(b.data[b.writeCursor:], buf)
	if int64(len(buf)) > remain {
		copy(b.data, buf[remain:])
	}

	// Update location of the cursor
	b.writeCursor = ((b.writeCursor + int64(len(buf))) % b.size)
	return n, nil
}
398158
func (b *Bucket) Put(key, value []byte) error {
	return b.PutFn(key, value)
}
163314
func (p *Pool) Put(bts []byte) {
	p.pool.Put(bts, cap(bts))
}
885709
func put(emitter *yaml_emitter_t, value byte) bool {
	if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
		return false
	}
	emitter.buffer[emitter.buffer_pos] = value
	emitter.buffer_pos++
	emitter.column++
	return true
}
339452
func (tb *TextBuf) Put(x, y int, c rune) {
	if x < 0 || y < 0 || x >= tb.W || y >= tb.H || c < ' ' {
		// debug.Printf("Ooooops Put(): %d, %d, %d='%c' \n", x, y, c, c)
		return
	}
	i := (tb.W+1)*y + x
	tb.Buf[i] = c
}
738895
func (b *Bucket) Put(key []byte, value []byte) error {
	_ = b.btree.ReplaceOrInsert(&item{key: key, value: value})
	return nil
}
416613
func (bufPool *BufioReaderPool) Put(b *bufio.Reader) {
	b.Reset(nil)
	bufPool.pool.Put(b)
}
286817
func (wp *WriterPool) Put(bw *bufio.Writer) {
	// Should reset even if we do Reset() inside Get().
	// This is done to prevent locking underlying io.Writer from GC.
	bw.Reset(nil)
	wp.pool.Put(bw, writerSize(bw))
}
1313590
func (b *BlockServerRemote) Put(
	ctx context.Context, tlfID tlf.ID, id kbfsblock.ID,
	bContext kbfsblock.Context, buf []byte,
	serverHalf kbfscrypto.BlockCryptKeyServerHalf,
	cacheType DiskBlockCacheType) (err error) {
	ctx = rpc.WithFireNow(ctx)
	dbc := b.config.DiskBlockCache()
	if dbc != nil {
		dbc.Put(ctx, tlfID, id, buf, serverHalf, cacheType)
	}
	size := len(buf)
	b.log.LazyTrace(ctx, "BServer: Put %s", id)
	defer func() {
		b.log.LazyTrace(ctx, "BServer: Put %s done (err=%v)", id, err)
		if err != nil {
			b.deferLog.CWarningf(
				ctx, "Put id=%s tlf=%s context=%s sz=%d err=%v",
				id, tlfID, bContext, size, err)
		} else {
			b.deferLog.CDebugf(
				ctx, "Put id=%s tlf=%s context=%s sz=%d",
				id, tlfID, bContext, size)
		}
	}()

	arg := kbfsblock.MakePutBlockArg(tlfID, id, bContext, buf, serverHalf)
	// Handle OverQuota errors at the caller
	return b.putConn.getClient().PutBlock(ctx, arg)
}
594136
func (c *ObjectLRU) Put(obj plumbing.EncodedObject) {
	c.mut.Lock()
	defer c.mut.Unlock()

	if c.cache == nil {
		c.actualSize = 0
		c.cache = make(map[interface{}]*list.Element, 1000)
		c.ll = list.New()
	}

	objSize := FileSize(obj.Size())
	key := obj.Hash()
	if ee, ok := c.cache[key]; ok {
		oldObj := ee.Value.(plumbing.EncodedObject)
		// in this case objSize is a delta: new size - old size
		objSize -= FileSize(oldObj.Size())
		c.ll.MoveToFront(ee)
		ee.Value = obj
	} else {
		if objSize > c.MaxSize {
			return
		}
		ee := c.ll.PushFront(obj)
		c.cache[key] = ee
	}

	c.actualSize += objSize
	for c.actualSize > c.MaxSize {
		last := c.ll.Back()
		if last == nil {
			c.actualSize = 0
			break
		}

		lastObj := last.Value.(plumbing.EncodedObject)
		lastSize := FileSize(lastObj.Size())

		c.ll.Remove(last)
		delete(c.cache, lastObj.Hash())
		c.actualSize -= lastSize
	}
}
808214
func (p *decoderPool) Put(d Decoder) {
	if p.pool == nil {
		return
	}
	p.pool.Put(d)
}
553294
func (c *Container) Put(key, value interface{}) {

	for k := 0; k < c.length; k++ {
		if equal(c.items[k].Key, key) {
			c.items[k].Value = value
			return
		}
	}
	if c.length == num {
		if c.next == nil {
			if c.pool != nil {
				c.next = c.pool.Get().(*Container)
			} else {
				c.next = New()
			}

		}
		c.next.Put(key, value)
		return
	}
	c.items[c.length] = item{key, value}
	c.length++
	return
}
494290
func (f *fsClient) Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide) (int64, *probe.Error) {
	return f.put(reader, size, nil, progress)
}
708984
func (p *intPool) put(is ...*big.Int) {
	if len(p.pool.data) > poolLimit {
		return
	}
	for _, i := range is {
		// verifyPool is a build flag. Pool verification makes sure the integrity
		// of the integer pool by comparing values to a default value.
		if verifyPool {
			i.Set(checkVal)
		}
		p.pool.push(i)
	}
}