// AppendByteChecked appends a byte to a byte slice getting a new slice from
// the CheckedBytesPool if the slice is at capacity
343218
func AppendByteChecked(
	bytes checked.Bytes,
	b byte,
	pool CheckedBytesPool,
) (
	result checked.Bytes,
	swapped bool,
) {
	orig := bytes

	if bytes.Len() == bytes.Cap() {
		newBytes := pool.Get(bytes.Cap() * 2)

		// Inc the ref to read/write to it
		newBytes.IncRef()
		newBytes.Resize(bytes.Len())

		copy(newBytes.Bytes(), bytes.Bytes())

		bytes = newBytes
	}

	bytes.Append(b)

	result = bytes
	swapped = orig != bytes

	if swapped {
		// No longer holding reference from the inc
		result.DecRef()
	}

	return
}
1233448
func (b *BlockGen) AddUncheckedTx(tx *types.Transaction) {
	b.txs = append(b.txs, tx)
}
1154190
func (p *PrrSender) OnPacketAcked(ackedBytes protocol.ByteCount) {
	p.bytesDeliveredSinceLoss += ackedBytes
	p.ackCountSinceLoss++
}
629662
func (fe *T) AppendBeSrvRTMTo(aggregate *memmetrics.RTMetrics, beSrvURLKey backend.SrvURLKey) {
	fe.mu.Lock()
	rtmCollect := fe.rtmCollect
	fe.mu.Unlock()

	if rtmCollect == nil {
		return
	}
	rtmCollect.AppendBeSrvRTMTo(aggregate, beSrvURLKey)
}
840840
func (a *DateHistogramAggregation) Keyed(keyed bool) *DateHistogramAggregation {
	a.keyed = &keyed
	return a
}
251348
func (ldr *AEBackupInformationListLoader) Append(v interface{}) error {
	if entity, ok := v.(*AEBackupInformation); ok {
		ldr.List = append(ldr.List, entity)
	} else {
		return fmt.Errorf("v is not *AEBackupInformation, actual: %#v", v)
	}

	return nil
}
1080713
func (j *journal) append(entry journalEntry) {
	j.entries = append(j.entries, entry)
	if addr := entry.dirtied(); addr != nil {
		j.dirties[*addr]++
	}
}
1123792
func (e *SimpleEventHandler) AddBytesAt(b []byte, lv int) {
	e.items = append(e.items, b)
	e.levels = append(e.levels, lv)
	if e.max < lv {
		e.max = lv
	}
}
615776
func NewMockCheckedBytesPool(ctrl *gomock.Controller) *MockCheckedBytesPool {
	mock := &MockCheckedBytesPool{ctrl: ctrl}
	mock.recorder = &MockCheckedBytesPoolMockRecorder{mock}
	return mock
}
750712
func (t Term) Append(args ...interface{}) Term {
	return constructMethodTerm(t, "Append", p.Term_APPEND, args, map[string]interface{}{})
}
689817
func (session *SafeSession) Append(shardSession *vtgatepb.Session_ShardSession, txMode vtgatepb.TransactionMode) error {
	session.mu.Lock()
	defer session.mu.Unlock()

	if session.autocommitState == autocommitted {
		panic("BUG: SafeSession.Append: unexpected autocommit state")
	}

	// Always append, in order for rollback to succeed.
	session.ShardSessions = append(session.ShardSessions, shardSession)
	if session.isSingleDB(txMode) && len(session.ShardSessions) > 1 {
		session.mustRollback = true
		return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "multi-db transaction attempted: %v", session.ShardSessions)
	}
	return nil
}
979297
func appendElement(htmlDoc *htmlDocument, parent *tagElement, e element) {
	if parent != nil {
		parent.appendChild(e)
	} else {
		htmlDoc.append(e)
	}
}
533256
func (c *ContentObj) AppendStreamSetGrayStroke(w float64) {
	w = fixRange10(w)
	var cache cacheContentGray
	cache.grayType = grayTypeStroke
	cache.scale = w
	c.listCache.append(&cache)
}
54346
func (tp *TicketPool) Append(diff *PoolDiff, height int64) error {
	if height != tp.tip+1 {
		return fmt.Errorf("block height %d does not build on %d", height, tp.tip)
	}
	tp.mtx.Lock()
	defer tp.mtx.Unlock()
	tp.append(diff)
	return tp.storeDiff(diff, height)
}
37546
func (t *Tags) Append(tag Tag) {
	t.values = append(t.values, tag)
}
1335392
func (t *TokenIntrospectionHandlers) Append(h TokenIntrospector) {
	for _, this := range *t {
		if reflect.TypeOf(this) == reflect.TypeOf(h) {
			return
		}
	}

	*t = append(*t, h)
}
369682
func NewCheckedBytesPool(
	sizes []Bucket,
	opts ObjectPoolOptions,
	newBackingBytesPool NewBytesPoolFn,
) CheckedBytesPool {
	return &checkedBytesPool{
		bytesPool: newBackingBytesPool(sizes),
		pool:      NewBucketizedObjectPool(sizes, opts),
	}
}