view src/lib/istream-internal.h @ 6142:6c0bfc35af03 HEAD

Removed memory pool parameter from iostreams. Default pool was almost always used, and the stream usually required destroying anyway so it didn't even make freeing memory easier.
author Timo Sirainen <tss@iki.fi>
date Tue, 24 Jul 2007 06:59:56 +0300
parents 834118e5329f
children e4eb71ae8e96
line wrap: on
line source

#ifndef __ISTREAM_INTERNAL_H
#define __ISTREAM_INTERNAL_H

#include "istream.h"
#include "iostream-internal.h"

#define I_STREAM_MIN_SIZE 4096

struct _istream {
/* inheritance: */
	struct _iostream iostream;

/* methods: */
	ssize_t (*read)(struct _istream *stream);
	void (*seek)(struct _istream *stream, uoff_t v_offset, bool mark);
	void (*sync)(struct _istream *stream);
	const struct stat *(*stat)(struct _istream *stream, bool exact);

/* data: */
	struct istream istream;

	int fd;
	uoff_t abs_start_offset;
	struct stat statbuf;

	const unsigned char *buffer;
	unsigned char *w_buffer; /* may be NULL */

	size_t buffer_size, max_buffer_size;
	size_t skip, pos;

	string_t *line_str; /* for i_stream_next_line() if w_buffer == NULL */
};

struct istream *
_i_stream_create(struct _istream *_buf, int fd, uoff_t abs_start_offset);

void _i_stream_compress(struct _istream *stream);
void _i_stream_grow_buffer(struct _istream *stream, size_t bytes);

#endif