lq-text: LQT_SetLastBlockInChain

API void LQT_SetLastBlockInChain (db, WID, Offsetp, FirstUnusedBytep, theBlock) t_LQTEXT_Database *db; t_WID WID; unsigned long *Offsetp; /* In: last offset */ unsigned char *FirstUnusedBytep; unsigned char *theBlock;

Purpose

LQT_Set­Last­Block­In­Chain maintains the chainend file in the database directory; this contains the block number of the last block in the chain used to store data for a given WID. This allows lqaddfile to update an entry efficiently, as otherwise it has to read the entire chain from the start to determine the last block before it can start appending to it. Failing to call this function after changing the last block number for a given WID will result in a corrupt database.

The given Offsetp is a pointer to a long, although the value is not changed; this is simply for consistency with other routines, and may change in the future. The FirstUnusedBytepp is currently used only for debugging; the value is recomputed from the data when it is used.

Errors

Fatal error if the cache file can't be created, if it isn't already open.

See Also: