<!DOCTYPE File PUBLIC "-//Liam Quin//DTD C API Documentation v1.1//EN" "doc.dtd"><File>
<Entry dir="liblqtext">
<Function File="../../src/liblqtext/pbcache.c">
<Name>LQT_FindFreeBlock</Name>
<Class>Database/Physical
<Purpose>
Allocates a block from the free list, and marks it as in use.
The block is at least BLOCKSIZE bytes long, and may be longer,
as contiguous free blocks are combined to make a single longer
block as long as will fit in a single cache entry.
If the BytesWanted argument is non-zero, the block will not
be more than BLOCKSIZE bytes longer than than BytesWanted bytes.
Since LQT_FindFreeBlock does not actually read the data from the
disk (or cache), it is up to the caller to ensure that LQT_ReadBlock
is called, and that the resulting block's header is filled in with
NumberOfBlocks equal to the value that LQT_FindFreeBlock stored in
BlockLengthp.
<Returns>
the byte offset in the data file of the block allocated, and also
the number of blocks allocated (in BlockLengthp).
<SeeAlso>
LQT_BlockIsCached
LQT_BlockIsFree
LQT_SetBlockStatus
</Function>
<Decl>
API unsigned long
LQT_FindFreeBlock(db, WID, BlockLengthp, BytesWanted)
    t_LQTEXT_Database *db;
    t_WID WID;
    unsigned int *BlockLengthp;
    unsigned long BytesWanted;
</Decl>
</Entry>
