// Free frees the palette created with AllocPalette().
// (https://wiki.libsdl.org/SDL_FreePalette)
515741
func (palette *Palette) Free() {
	C.SDL_FreePalette((*C.SDL_Palette)(unsafe.Pointer(palette)))
}
314564
func (t TreePalette) ColorPalette() color.Palette {
	if t.Root == nil {
		return nil
	}
	p := make(color.Palette, 0, t.Leaves)
	t.Walk(func(leaf *Node, i int) {
		p = append(p, leaf.Color)
	})
	return p
}
1168897
func (a *MinMaxAllocator) Allocate(i int) (bool, error) {
	a.lock.Lock()
	defer a.lock.Unlock()

	if !a.inRange(i) {
		return false, ErrOutOfRange
	}

	if a.has(i) {
		return false, ErrConflict
	}

	a.used[i] = true
	a.free--

	return true, nil
}
805258
func (renderer *Renderer) Clear() error {
	return errorFromInt(int(
		C.SDL_RenderClear(renderer.cptr())))
}
131768
func SoftPalette(colorsCount int) ([]Color, error) {
	return SoftPaletteEx(colorsCount, SoftPaletteSettings{nil, 50, false})
}
577041
func (d Data) IsFree(split uint) error {
	want := d.filesize + split
	if d.freeSpace() < want {
		return errors.Errorf("there is not sufficient free space in a disk")
	}

	return nil
}
772966
func (f *freelist) free(txid txid, p *page) {
	if p.id <= 1 {
		panic(fmt.Sprintf("cannot free page 0 or 1: %d", p.id))
	}

	// Free page and all its overflow pages.
	var ids = f.pending[txid]
	for id := p.id; id <= p.id+pgid(p.overflow); id++ {
		// Verify that page is not already free.
		if f.cache[id] {
			panic(fmt.Sprintf("page %d already freed", id))
		}

		// Add to the freelist and cache.
		ids = append(ids, id)
		f.cache[id] = true
	}
	f.pending[txid] = ids
}
450168
func (b *ByteBuf) Release() {
	b.pool.Free(b.buf)
	b.buf = nil
}
1041809
func (a *MinMaxAllocator) Free() int {
	a.lock.Lock()
	defer a.lock.Unlock()
	return a.free
}
879706
func (p *StoragePool) Free() error {
	var err C.virError
	ret := C.virStoragePoolFreeWrapper(p.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
1151640
func (v *Stream) Free() error {
	var err C.virError
	ret := C.virStreamFreeWrapper(v.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
1359419
func freeBinds(binds []oci8Bind) {
	for _, bind := range binds {
		if bind.pbuf != nil {
			freeBuffer(bind.pbuf, bind.dataType)
			bind.pbuf = nil
		}
		if bind.length != nil {
			C.free(unsafe.Pointer(bind.length))
			bind.length = nil
		}
		if bind.indicator != nil {
			C.free(unsafe.Pointer(bind.indicator))
			bind.indicator = nil
		}
		bind.bindHandle = nil // freed by oci statement close
	}
}
1215340
func (f *NWFilterBinding) Free() error {
	if C.LIBVIR_VERSION_NUMBER < 4005000 {
		return makeNotImplementedError("virNWFilterBindingFree")
	}
	var err C.virError
	ret := C.virNWFilterBindingFreeWrapper(f.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
178307
func (pool *SyncPool) Free(mem []byte) {
	if size := cap(mem); size <= pool.maxSize {
		for i := 0; i < len(pool.classesSize); i++ {
			if pool.classesSize[i] >= size {
				pool.classes[i].Put(&mem)
				return
			}
		}
	}
}
431305
func (sbc StackedBarChart) GetColorPalette() ColorPalette {
	if sbc.ColorPalette != nil {
		return sbc.ColorPalette
	}
	return AlternateColorPalette
}
707579
func (b *Buffer) Release() error {
	if b == nil || b.C_gss_buffer_t == nil {
		return nil
	}

	defer func() {
		C.free(unsafe.Pointer(b.C_gss_buffer_t))
		b.C_gss_buffer_t = nil
		b.alloc = allocNone
	}()

	// free the value as needed
	switch {
	case b.C_gss_buffer_t.value == nil:
		// do nothing

	case b.alloc == allocMalloc:
		C.free(b.C_gss_buffer_t.value)

	case b.alloc == allocGSSAPI:
		var min C.OM_uint32
		maj := C.wrap_gss_release_buffer(b.Fp_gss_release_buffer, &min, b.C_gss_buffer_t)
		err := b.stashLastStatus(maj, min)
		if err != nil {
			return err
		}
	}

	return nil
}
715800
func (c *copyOnWriteContext) freeNode(n *node) freeType {
	if n.cow == c {
		// clear to allow GC
		n.items.truncate(0)
		n.children.truncate(0)
		n.cow = nil
		if c.freelist.freeNode(n) {
			return ftStored
		} else {
			return ftFreelistFull
		}
	} else {
		return ftNotOwned
	}
}