// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT.

//go:build (freebsd && amd64) || (freebsd && arm64) || (windows && (amd64 || arm64))

package sqlite3

import (
	"unsafe"

	"modernc.org/libc"
)

// C documentation
//
//	/*
//	** The %_data table is completely empty when this function is called. This
//	** function populates it with the initial structure objects for each index,
//	** and the initial version of the "averages" record (a zero-byte blob).
//	*/
func _sqlite3Fts5IndexReinit(tls *libc.TLS, p uintptr) (r int32) {
	bp := tls.Alloc(48)
	defer tls.Free(48)
	var pTmp uintptr
	var _ /* uFts at bp+0 */ struct {
		FtmpSpace    [0][48]Tu8
		FsFts        TFts5Structure
		F__ccgo_pad2 [16]byte
	}
	_ = pTmp
	_fts5StructureInvalidate(tls, p)
	_fts5IndexDiscardData(tls, p)
	pTmp = bp
	libc.Xmemset(tls, bp, 0, uint64(48))
	if (*TFts5Config)(unsafe.Pointer((*TFts5Index)(unsafe.Pointer(p)).FpConfig)).FbContentlessDelete != 0 {
		(*TFts5Structure)(unsafe.Pointer(pTmp)).FnOriginCntr = uint64(1)
	}
	_fts5DataWrite(tls, p, int64(FTS5_AVERAGES_ROWID), __ccgo_ts+1702, 0)
	_fts5StructureWrite(tls, p, pTmp)
	return _fts5IndexReturn(tls, p)
}

// C documentation
//
//	/*
//	** Turn bulk memory into a valid Parse object and link that Parse object
//	** into database connection db.
//	**
//	** Call sqlite3ParseObjectReset() to undo this operation.
//	**
//	** Caution:  Do not confuse this routine with sqlite3ParseObjectInit() which
//	** is generated by Lemon.
//	*/
func _sqlite3ParseObjectInit(tls *libc.TLS, pParse uintptr, db uintptr) {
	libc.Xmemset(tls, pParse+uintptr(uint64(libc.UintptrFromInt32(0)+8)), 0, uint64(libc.UintptrFromInt32(0)+192)-uint64(libc.UintptrFromInt32(0)+8))
	libc.Xmemset(tls, pParse+uintptr(uint64(libc.UintptrFromInt32(0)+288)), 0, libc.Uint64FromInt64(424)-uint64(libc.UintptrFromInt32(0)+288))
	(*TParse)(unsafe.Pointer(pParse)).FpOuterParse = (*Tsqlite3)(unsafe.Pointer(db)).FpParse
	(*Tsqlite3)(unsafe.Pointer(db)).FpParse = pParse
	(*TParse)(unsafe.Pointer(pParse)).Fdb = db
	if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 {
		_sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1672, 0)
	}
}

/*
** Maximum number of times that we will try again to prepare a statement
** that returns SQLITE_ERROR_RETRY.
 */
