dovecot-2.0: Added i_stream_get_absolute_offset().
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 1 20:34:04 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/0c82fe7ce578
changeset: 12225:0c82fe7ce578
user: Timo Sirainen <tss at iki.fi>
date: Fri Oct 01 18:33:19 2010 +0100
description:
Added i_stream_get_absolute_offset().
diffstat:
src/lib/istream.c | 5 +++++
src/lib/istream.h | 3 +++
2 files changed, 8 insertions(+), 0 deletions(-)
diffs (28 lines):
diff -r e7768ec9d3de -r 0c82fe7ce578 src/lib/istream.c
--- a/src/lib/istream.c Fri Oct 01 17:46:03 2010 +0100
+++ b/src/lib/istream.c Fri Oct 01 18:33:19 2010 +0100
@@ -292,6 +292,11 @@
return !i_stream_have_bytes_left(stream);
}
+uoff_t i_stream_get_absolute_offset(struct istream *stream)
+{
+ return stream->real_stream->abs_start_offset + stream->v_offset;
+}
+
static char *i_stream_next_line_finish(struct istream_private *stream, size_t i)
{
char *ret;
diff -r e7768ec9d3de -r 0c82fe7ce578 src/lib/istream.h
--- a/src/lib/istream.h Fri Oct 01 17:46:03 2010 +0100
+++ b/src/lib/istream.h Fri Oct 01 18:33:19 2010 +0100
@@ -107,6 +107,9 @@
bool i_stream_have_bytes_left(const struct istream *stream) ATTR_PURE;
/* Returns TRUE if there are no bytes buffered and read() returns EOF. */
bool i_stream_is_eof(struct istream *stream);
+/* Returns the absolute offset of the stream. This is the stream's current
+ v_offset + the parent's absolute offset when the stream was created. */
+uoff_t i_stream_get_absolute_offset(struct istream *stream);
/* Gets the next line from stream and returns it, or NULL if more data is
needed to make a full line. i_stream_set_return_partial_line() specifies
More information about the dovecot-cvs
mailing list