Exemple #1
0
static void bc_reset(struct bufferchain *bc)
{
	/* Free current chain, possibly stuffing back into the pool. */
	while(bc->first)
	{
		struct buffy* buf = bc->first;
		bc->first = buf->next;
		bc_free(bc, buf);
	}
	bc_fill_pool(bc); /* Ignoring an error here... */
	bc_init(bc);
}
Exemple #2
0
static void bc_reset( bufferchain_t *bc )
{
	// free current chain, possibly stuffing back into the pool.
	while( bc->first )
	{
		buffy_t *buf = bc->first;
		bc->first = buf->next;
		bc_free( bc, buf );
	}

	bc_fill_pool( bc );	// ignoring an error here...
	bc_init( bc );
}
Exemple #3
0
// throw away buffies that we passed.
static void bc_forget( bufferchain_t *bc )
{
	buffy_t	*b = bc->first;

	// free all buffers that are def'n'tly outdated
	// we have buffers until filepos... delete all buffers fully below it
	while( b != NULL && bc->pos >= b->size )
	{
		buffy_t	*n = b->next;	// != NULL or this is indeed the end and the last cycle anyway

		if( n == NULL )
			bc->last = NULL;	// Going to delete the last buffy...
		bc->fileoff += b->size;
		bc->pos  -= b->size;
		bc->size -= b->size;
		bc_free( bc, b );
		b = n;
	}

	bc->first = b;
	bc->firstpos = bc->pos;
}
Exemple #4
0
/* Throw away buffies that we passed. */
static void bc_forget(struct bufferchain *bc)
{
	struct buffy *b = bc->first;
	/* free all buffers that are def'n'tly outdated */
	/* we have buffers until filepos... delete all buffers fully below it */
	if(b) debug2("bc_forget: block %lu pos %lu", (unsigned long)b->size, (unsigned long)bc->pos);
	else debug("forget with nothing there!");

	while(b != NULL && bc->pos >= b->size)
	{
		struct buffy *n = b->next; /* != NULL or this is indeed the end and the last cycle anyway */
		if(n == NULL) bc->last = NULL; /* Going to delete the last buffy... */
		bc->fileoff += b->size;
		bc->pos  -= b->size;
		bc->size -= b->size;

		debug5("bc_forget: forgot %p with %lu, pos=%li, size=%li, fileoff=%li", (void*)b->data, (long)b->size, (long)bc->pos,  (long)bc->size, (long)bc->fileoff);

		bc_free(bc, b);
		b = n;
	}
	bc->first = b;
	bc->firstpos = bc->pos;
}